I am trying to create a SQLite database, working within Jupyter Notebook.
However, when I run the command to create the database, I'm presented with the error 'No module named 'sqlite''. (See image for full command and response).
Checking the 'Environments' page of Anaconda Navigator, I can see that 'sqlite' is actually listed as an installed package.
What am I missing out?
I use sqlalchemy which takes away a lot of pain. You can install it like this in a Jupyter notebook cell (note the !)
!pip install sqlalchemy
Then your code would be as follows.
from sqlalchemy import create_engine
engine = create_engine('sqlite:///first_db.sqlite')
connection = engine.connect()
Related
I have a Jupyter notebook running within an Amazon SageMaker Studio Lab (https://studiolab.sagemaker.aws/) environment, and I want to use Tensordboard to monitor my model's performance inside the notebook.
I have used the following commands to set up the Tensorboard:
%load_ext tensorboard
# tb_log_dir variable holds the path to the log directory
%tensorboard --logdir tb_log_dir
But nothing shows up in the output of the cell where I execute the commands. See:
The two buttons shown in the picture are not responding, BTW.
How to solve this problem? Any suggestions would be appreciated.
I would try the canonical way to use tensorboard in AWS Sagemaker, it should be supported also by Studio Lab, it is described here. Basically install tensorboard and using the EFS_PATH_LOG_DIR launch tensorboard using the embedded console (you can do the following also from a cell):
pip install tensorboard
tensorboard --logdir <EFS_PATH_LOG_DIR>
Be careful with the EFS_PATH_LOG_DIR, be sure this folder is valida path from the location you are, for example by default you are located in studio-lab-user/sagemaker-studiolab-notebooks/ so the proper command would be !tensorboard --logdir logs/fit.
Then open a browser to:
https://<YOUR URL>/studiolab/default/jupyter/proxy/6006/
import jpype
import asposecells
jpype.startJVM()
from asposecells.api import *
for this code, I get the following error
JVMNotFoundException: No JVM shared library file (jvm.dll) found. Try setting up the JAVA_HOME environment variable properly.
I am doing this through anaconda, in jupyter notebook. I am trying to get the workbook from aspose cell.
It seems configuration issue. Try to setup your environment properly. Make sure to install Java and setup JAVA_HOME and Path environment variables accordingly, see the document on how to setup environment and installation to use Aspose.Cells for Python via Java for your reference. You may also post your queries in the dedicated section.
PS. I am working as Support developer/ Evangelist at Aspose.
I am using the -idefix- R package and I do not want to install it everytime I log into Google Colab. Is there any way of installing it permanently? Will it also be installed for other people if I share the notebook.
Thank you :)
Like what you could do in a local computer, copy the source local R library to the target location. See some instruction in this blog ( atusy.net )
Here are two CoLab notebooks to reproduce the import and export R library.
CoLab Notebook export local library
CoLab Notebook import local library
Here are some minimal snippets in this I/O process.
Open a CoLab notebook in Python,
# activate R magic
%load_ext rpy2.ipython
Make the notebook available for R.
%%R
install.packages('tidymodels')
tar("library.tar.gz", "/usr/local/lib/R/site-library")
Install the package tidymodels, and zip your library with installed packages.
from google.colab import drive
drive.mount('/content/drive')
Connect your google drive and make a copy for use in the future.
%cp library.tar.gz drive/MyDrive/src/
drive/MyDrive/src/ is the path I choose, you can use another.
Next, you use this library in another or new notebook.
from google.colab import drive
drive.mount('/content/drive')
Connect your Google Drive.
%cp drive/MyDrive/src/library.tar.gz .
Copy it in your working directory.
!tar xf library.tar.gz
Extract the installed packages from the zipped file.
.libPaths('usr/local/lib/R/site-library/')
update the Library path and put it at the top ranking.
library(tidymodels)
Check, this package is of reuse
As far as I understand it, each virtual machine is recycled after you close the browser window or the session is longer than 12 hours. There is no possibility to install packages in a way that you can access them without installing them again (to the best of my knowledge).
I am trying to load jupyter notebook with PyPy. I have done it already on different machines and I never got any problem. This time, however, (on an iMac with OSX 10.11.16) I am getting the following error message:
This is the script I use to load the notebook with PyPy:
import re
import sys
from IPython import start_ipython
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(start_ipython())
I run it from bash: pypy script.py notebook
If I run it without notebook, the IPython session starts as it is supposed to, so the issue must be related to the notebook but I can figure it out. Of course, zeromq is installed, but I have no idea what headers in the error message refers to... Any clue on how to solve this?
P.S. I have used pypy -m pip install jupyter to install it.
"zeromq headers" means what is necessary for developing with, as opposed to only using, the zeromq library. It may be in some "zeromq-dev" package or similar, depending on what distribution system you use on your OS/X.
Normally you'd get such an error when trying to do pip install, but in this case, "zmq" is written using the old CFFI style, deprecated since 2015; as a result it requires the headers at run-time.
I am running ipython notebook on my OSX machine and/or my ubuntu 14.04 machine. I am using ipython 3.0.0, and ipython (jupyter) notebooks.
When I start an ipython notebook, under New there is a terminal option, but it's unavailable for me.
I haven't been able to find any documentation on this feature, how to activate it or what it does.
The ipython notebook --help command doesn't mention it and I haven't found anything in the documentation either.
I haven't discovered the special keywords to search google for to get any information either.
What does this feature do? How do I activate it? Is there any documentation on this available?
IPython/Jupyter appears to support browser-based interactive terminal sessions. This is enabled on my machine by installing the terminado package with pip or conda. This fixes the "Terminals Unavailable" message on the drop-down, and lets me start up a (bash) terminal session in a new tab.
See this commit:
IPython on GitHub
Here's the code in Lib/site-packages/IPython/html/notebookapp.py responsible for this item (located the file by searching the source for "Terminals" case-sensitively):
def init_terminals(self):
try:
from .terminal import initialize
initialize(self.web_app)
self.web_app.settings['terminals_available'] = True
except ImportError as e:
log = self.log.debug if sys.platform == 'win32' else self.log.warn
log("Terminals not available (error was %s)", e)
As you can see, there should be a message in the console log specifying what went wrong (you may need to increase log verbosity with ipython notebook --log-level=<level> to see it). In my case, it said:
Terminals not available (error was No module named fcntl)
The html.terminal module that is being imported appears to provide a web-based IPython interactive console.
Support for Windows terminals with terminado dependency was added in Jupyter 5.3.0:
https://github.com/jupyter/notebook/pull/3087
Actually it's jupyter notebook 5.3.0, not jupyter. the two versions is not the same thing.
- jupyter --version
- jupyter notebook --version
I ever suffered from this.