I updated my Jupyter Notebook and it does not create a new notebook under the current directory as it used to. Instead, it always creates a new notebook under the start-up directory.This happens on my Mac and Windows computers. How can I fix this?
1) Creating a new notebook under project1
2) A new notebook was successfully created
3) However, this notebook was created under the jupyter start-up directory rather than project1
Jupyter did not behave like this before. Is this a bug or intended behavior?
Here are my Jupyter related package versions.
# Name Version Build Channel
jupyter 1.0.0 py36h598a6cc_0
jupyter_client 5.2.2 py36_0
jupyter_console 5.2.0 py36hccf5b1c_1
jupyter_contrib_core 0.3.3 py36_1 conda-forge
jupyter_contrib_nbextensions 0.3.3 py36_0 conda-forge
jupyter_core 4.4.0 py36h79cf704_0
jupyter_highlight_selected_word 0.1.0 py36_0 conda-forge
jupyter_latex_envs 1.4.0 py36_1 conda-forge
jupyter_nbextensions_configurator 0.4.0 py36_0 conda-forge
jupyterlab 0.27.0 py36hd3092eb_2
jupyterlab_launcher 0.4.0 py36h93e02e9_0
notebook 5.3.1 py36_1
Per ilyas's advice, updated my notebook to 5.4.0 and this issue was resolved.
Solution: Run
conda update conda
And then:
conda update --all
in your anaconda prompt. There are recent updates to jupyter that will fix this issue.
Related
I currently decided to re-install jupyter since the kernel was continuously stopping. After having conda uninstalled ipykernel and re-installed it back, I incurred in a series of issues:
First once I opened the notebooks on jupyter a 500 internal error occurred;
Second I tried to re-install nbconvert as suggested in some issues on the topic but nothing changed;
third I tried to conda re-install jupyter but now even jupyter command is not working
I am currently on Mac OS Catalina Version 10.15.7. I have done a conda list and apparently everything is installed on the (base) environment where I am operating, namely:
ipykernel 6.15.2 pypi_0 pypi
...
jupyter 1.0.0 py38hecd8cb5_8
jupyter-client 7.3.5 pypi_0 pypi
jupyter-console 6.4.4 pypi_0 pypi
jupyter-telemetry 0.1.0 pypi_0 pypi
jupyter_client 7.3.4 py38hecd8cb5_0
jupyter_console 6.4.3 pyhd3eb1b0_0
jupyter_core 4.10.0 py38hecd8cb5_0
jupyter_server 1.13.5 pyhd3eb1b0_0
jupyterhub 2.3.1 pypi_0 pypi
jupyterlab 3.3.2 pyhd3eb1b0_0
jupyterlab-pygments 0.2.2 pypi_0 pypi
jupyterlab-widgets 3.0.3 pypi_0 pypi
jupyterlab_server 2.10.3 pyhd3eb1b0_1
jupyterlab_widgets 1.0.0 pyhd3eb1b0_1
...
nbconvert 7.0.0 pypi_0 pypi
Am I doing something wrong? How can I solve the issue with all the needed packages up to date?
EDIT: Furthermore when I type simple commands such as conda list the following appears:
(base) MacBook-Pro-di-federico:Dropbox federiconutarelli$ conda list
Error processing line 1 of /Users/federiconutarelli/opt/anaconda3/lib/python3.8/site-packages/matplotlib-3.5.2-py3.8-nspkg.pth:
Traceback (most recent call last):
File "/Users/federiconutarelli/opt/anaconda3/lib/python3.8/site.py", line 169, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "<frozen importlib._bootstrap>", line 553, in module_from_spec
AttributeError: 'NoneType' object has no attribute 'loader'
Reminder of file ignored
...
before listing the packages.
Thank you
If you have installed a more recent version of "jinja2", it may break "nbconvert".
You can either try to update "nbconvert" or downgrade "jinja2".
Jupyter Notebook 500 : Internal Server Error
I am trying to create and run a jupyter notebook (jupyter notebook --port xxxx) in the directory of a project I am working on to do some debugging. When I try to run it the notebook fails to connect to a kernel with the following error returned by the server repeatedly:
[I 17:29:24.011 NotebookApp] KernelRestarter: restarting kernel (5/5), new random ports
2022-01-28 17:29:24.789877: I tensorflow/stream_executor/platform/default/dso_loader.cc:49]
Successfully opened dynamic library libcudart.so.11.0
usage: ipykernel_launcher.py [-h] --config CONFIG [--results_dir RESULTS_DIR]
ipykernel_launcher.py: error: the following arguments are required: --config
This is an empty notebook where I am trying to execute the first cell, it happens irrespective of the code that this cell contains. On top of that I CAN RUN A NOTEBOOK IN ANY OTHER DIRECTORY FROM THE SAME SERVER which makes this extra strange!
It seems that jupyter implicitly runs some code during kernel start that reads whatever is in my project directory out of context and inevitably fails to run it. I want to run it in that very directory to test the module I am working on.
I tried deleting .ipynb_checkpoints, restarting the server and recreating the notebook from scratch, but that didn't help.
Here is a selected pip list of the modules I have installed in my conda environment. Python version == 3.7.0
Package Version
----------------------- ---------
importlib-metadata 4.10.1
importlib-resources 5.4.0
ipykernel 6.7.0
ipython 7.31.1
ipython-genutils 0.2.0
ipywidgets 7.6.5
jupyter 1.0.0
jupyter-client 7.1.2
jupyter-console 6.4.0
jupyter-core 4.9.1
jupyterlab-pygments 0.1.2
jupyterlab-widgets 1.0.2
Keras-Preprocessing 1.1.2
matplotlib 3.5.1
matplotlib-inline 0.1.3
nbclient 0.5.10
nbconvert 6.4.1
nbformat 5.1.3
notebook 6.4.8
numpy 1.19.5
pandas 1.1.5
scipy 1.7.3
tensorboard 2.8.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorflow-estimator 2.4.0
tensorflow-gpu 2.4.0
typing 3.7.4.3
typing_extensions 4.0.1
Edit: This file is contained in the same directory as the notebook I am trying to run:
import argparse
from myModule.training import main
parser = argparse.ArgumentParser()
parser.add_argument('--config', type=str, required=True)
parser.add_argument('--results_dir', type=str, default='results_training')
args = parser.parse_args()
config = args.config
results_dir = args.results_dir
hist = main(config, results_dir)
I'm trying to install jupyter-matplotlib extension but can't make it work in a jupyterlab instance.
Once installed by following the steps here:
https://github.com/matplotlib/jupyter-matplotlib
I get the error when executing a simple example:
Error displaying widget: model not found
Here's the output of my $ conda list for relevant packages:
ipykernel 5.1.1
ipympl 0.2.1
ipython 7.6.1
ipython_genutils 0.2.0
ipywidgets 7.5.0
jupyter_client 5.3.1
jupyter_core 4.4.0
jupyterlab 1.0.2
jupyterlab_server 1.0.0
Solved!
Turned out ipywidget 7.5 breaks jupyter lab and it isaffecting other libraries too.
https://github.com/plotly/plotly.py/issues/1659
downgrading to 7 solved the issue for me (allthough 7 wrt 7.5 should be backward compatibile)!
Also be sure to match ipympl 0.2.1 with jupyter-matplotlib 0.3.0 labextension.
jupyter labextension install jupyter-matplotlib#0.3.0
First you need to install:
pip install ipywidgets
conda install -c conda-forge ipympl
Then check if the following is OK:
!jupyter labextension list
You should see something like this:
JupyterLab v3.0.14
/home/jovyan/.local/share/jupyter/labextensions
jupyter-leaflet v0.15.0 enabled OK
jupyterlab-plotly v5.1.0 enabled OK
#jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
The most important part is here:
Restart your jupyter notebook.
I'm stumped. I'm developing some enhancements to scikit-image which are failing the automated build tests, probably due to rounding errors. I therefore need to get the automated tests running on my Windows system so that I can debug and work out what's wrong. I've so far tried two approaches, neither of which are working:
In my Anaconda Python 3.6 environment, when I try to run the automated tests, I am getting the following error:
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
...which I have found reference to in other contexts, but have not been able to eliminate.
Since the automated test do run (but fail) on a Python 3.5-based system, I thought things might work if I tried a local Python 3.5 environment. Here, I am running into the issue that, despite being installed, the environment cannot find the MS C++ compiler cl.exe. It is installed in C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\ and is found and executed by my Python 3.6 environment, but my Python 3.5 environment doesn't find it despite me adding that directory to my PATH. I should add that my Python 3.6 environment finds it without the directory being added to the PATH. I understand that both Python 3.5 and 3.6 use MSVC 14.0.
I would prefer to fix the problem in my Python 3.6 environment if possible. Any assistance much appreciated.
Update
I have made a box-fresh Python 3.6 conda environment as follows:
conda create --name sk36 python=3.6
conda activate sk36
conda install scikit-image --only-deps
conda install cython
git clone https://github.com/scikit-image/scikit-image.git
cd scikit-image
pip install -e .
pytest skimage/feature
The specific error I am getting is as follows:
..\Anaconda3\lib\site-packages\py\_path\local.py:662: in pyimport
__import__(modname)
skimage\__init__.py:135: in <module>
from .data import data_dir
skimage\data\__init__.py:13: in <module>
from ..io import imread, use_plugin
skimage\io\__init__.py:7: in <module>
from .manage_plugins import *
skimage\io\manage_plugins.py:24: in <module>
from .collection import imread_collection_wrapper
skimage\io\collection.py:12: in <module>
from ..external.tifffile import TiffFile
skimage\external\tifffile\__init__.py:1: in <module>
from .tifffile import imsave, imread, imshow, TiffFile, TiffWriter, TiffSequence
skimage\external\tifffile\tifffile.py:292: in <module>
from . import _tifffile
E RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
...which appears to have something to do with tifffile. Since this package wasn't originally explicitly installed in my new environment, I tried installing various versions of it, including some which downgraded numpy and scipy. Still the same error as above.
Having done some more research it would appear that something is seeing numpy 1.13.x when in fact version 1.15.4 is installed. Here is the full output from conda list:
# Name Version Build Channel
blas 1.0 mkl anaconda
ca-certificates 2018.03.07 0 anaconda
certifi 2018.10.15 py36_0 anaconda
cloudpickle 0.6.1 py36_0 anaconda
cycler 0.10.0 py36h009560c_0 anaconda
cython 0.29 py36ha925a31_0 anaconda
dask-core 0.20.0 py36_0 anaconda
decorator 4.3.0 py36_0 anaconda
freetype 2.9.1 ha9979f8_1 anaconda
icc_rt 2017.0.4 h97af966_0 anaconda
icu 58.2 ha66f8fd_1 anaconda
imageio 2.4.1 py36_0 anaconda
intel-openmp 2019.0 118 anaconda
jpeg 9b hb83a4c4_2 anaconda
kiwisolver 1.0.1 py36h6538335_0 anaconda
libpng 1.6.35 h2a8f88b_0 anaconda
libtiff 4.0.9 h36446d0_2 anaconda
matplotlib 3.0.1 py36hc8f65d3_0 anaconda
mkl 2019.0 118 anaconda
mkl_fft 1.0.6 py36hdbbee80_0 anaconda
mkl_random 1.0.1 py36h77b88f5_1 anaconda
networkx 2.2 py36_1 anaconda
numpy 1.15.4 py36ha559c80_0 anaconda
numpy-base 1.15.4 py36h8128ebf_0 anaconda
olefile 0.46 py36_0 anaconda
openssl 1.0.2p hfa6e2cd_0 anaconda
package_has_been_revoked 1.0 0 enable_revoked
pillow 5.3.0 py36hdc69c19_0 anaconda
pip 18.1 py36_0 anaconda
pyparsing 2.3.0 py36_0 anaconda
pyqt 5.9.2 py36h6538335_2 anaconda
python 3.6.7 h33f27b4_1 anaconda
python-dateutil 2.7.5 py36_0 anaconda
pytz 2018.7 py36_0 anaconda
pywavelets 1.0.1 py36h8c2d366_0 anaconda
qt 5.9.6 vc14h1e9a669_2 anaconda
scikit-image 0.15.dev0 <pip>
scipy 1.1.0 py36h4f6bf74_1 anaconda
setuptools 40.5.0 py36_0 anaconda
sip 4.19.8 py36h6538335_0 anaconda
six 1.11.0 py36_1 anaconda
sqlite 3.25.2 hfa6e2cd_0 anaconda
tifffile 0.15.1 py36h452e1ab_1001 conda-forge
tk 8.6.8 hfa6e2cd_0 anaconda
toolz 0.9.0 py36_0 anaconda
tornado 5.1.1 py36hfa6e2cd_0 anaconda
vc 14.1 h21ff451_3 anaconda
vs2015_runtime 15.5.2 3 anaconda
wheel 0.32.2 py36_0 anaconda
wincertstore 0.2 py36h7fe50ca_0 anaconda
zlib 1.2.11 h8395fce_2 anaconda
Update 2
I've solved the problem for Python 3.6, and I think there's enough information above for the astute to be able to work out what was wrong. I'll put the solution in an answer below.
A cleanly built Python 3.5 environment can't find the compiler, so that issue still remains.
One approach you could try is to upgrade your numpy with
pip install numpy --upgrade
as described here: RuntimeError: module compiled against API version a but this version of numpy is 9
Otherwise (if for some reason you cannot upgrade numpy) I would suggest going with a virtual environment for scikit-image project. I just tried it on Windows 10 and was able to successfully execute tests. My steps (from cmd, inside the project folder):
conda uninstall scikit-image to remove any previously built/installed versions
conda -n scikit-image python=3.6 to create a virtual environment for this project (I used python 3.6, but you can change it to 3.5)
activate scikit-image activated the new virtual env
pip install -r requirements.txt -- installed dependencies (without this step I wasn't getting the dependencies for tests installed)
pip install -e .
pytest
It turns out that pytest wasn't actually installed in the correct environment, it was being invoked from base which did indeed have numpy 1.13.3 installed. Installing it in the cleanly built Python 3.6 environment solved the problem for Python 3.6 at least.
I am writing a script that simply asks the google api for the latitudes and longitudes for a list of addresses read in from a csv file and outputs an html with the googlemap widget embedded. Further I hoped to run pyinstaller in order to make this into a .exe.
Running the code on my original conda environment it works fine however the .exe that pyinstaller creates is massive for such a small script (over 300mb). As such, I created a new virtual environment in which to work and have installed what I believe to be the bare minimum packages necessary and have rewritten the code to use as few packages as I am able which for the currently working portion of the code dropped it down considerably to just over 10 mb. (No numpy or pandas for me... ah well).
The code again works fine up until the final step:
from ipywidgets.embed import embed_minimal_html
embed_minimal_html("exporttest.html", None)
The above line should take any widgets, in particular the figure created from
fig = gmaps.figure(layout=figure_layout)
markers = gmaps.marker_layer(coordinates)
fig.add_layer(markers)
fig
Running the currently modified version in my original conda environment with all my of my usual packages installed this runs as expected without errors. Running on the virtual environment however on the mentioned lines I get the following key error:
KeyError Traceback (most recent call last)
c:\programdata\anaconda3\envs\synod_environ\lib\sre_parse.py in
parse_template(source, pattern)
1020 try:
-> 1021 this = chr(ESCAPES[this][1])
1022 except KeyError:
KeyError: '\\u'
During handling of the above exception, another exception occurred:
error Traceback (most recent call last)
<ipython-input-5-3359941239ab> in <module>
1 from ipywidgets.embed import embed_minimal_html
2
----> 3 embed_minimal_html("exporttest.html", None)
...
error: bad escape \u at position 0
(For clarification, key error has two slashes before the u, some frustration in getting this to post correctly)
As the code runs correctly in the one environment but not the other, I can only assume that I'm missing a package somewhere that ipywidgets requires, but running pip check doesn't notify me of anything missing.
pip list returns the following packages:
altgraph 0.16.1
backcall 0.1.0
bleach 3.0.2
certifi 2018.10.15
chardet 3.0.4
colorama 0.4.0
decorator 4.3.0
defusedxml 0.5.0
entrypoints 0.2.3
future 0.17.1
geojson 2.4.1
gmaps 0.8.2
idna 2.7
ipykernel 5.1.0
ipython 7.1.1
ipython-genutils 0.2.0
ipywidgets 7.4.2
jedi 0.13.1
Jinja2 2.10
jsonschema 2.6.0
jupyter 1.0.0
jupyter-client 5.2.3
jupyter-console 6.0.0
jupyter-core 4.4.0
macholib 1.11
MarkupSafe 1.0
mistune 0.8.4
nbconvert 5.4.0
nbformat 4.4.0
notebook 5.7.0
pandocfilters 1.4.2
parso 0.3.1
pefile 2018.8.8
pickleshare 0.7.5
pip 10.0.1
prometheus-client 0.4.2
prompt-toolkit 2.0.7
Pygments 2.2.0
PyInstaller 3.4
python-dateutil 2.7.5
pywin32-ctypes 0.2.0
pywinpty 0.5.4
pyzmq 17.1.2
qtconsole 4.4.2
requests 2.20.0
Send2Trash 1.5.0
setuptools 40.4.3
six 1.11.0
terminado 0.8.1
testpath 0.4.2
tornado 5.1.1
traitlets 4.3.2
urllib3 1.24
wcwidth 0.1.7
webencodings 0.5.1
wheel 0.32.2
widgetsnbextension 3.4.2
wincertstore 0.2
Any thoughts on how to further identify what went wrong, what package might be missing or how to fix the issue, and/or alternate ways to save a googlemaps output?
Fiddling with it and comparing from one environment to the other, I found that my virtual environment had ipywidgets 7.4.2 while the base environment had ipywidgets 7.2.1. Downgrading versions fixed the issue I was having.