I am a newbie to python and needed to set up IPython for some project-work. I followed the Anaconda Installation Directions . Currently I am having a lot of problem in running IPython :
First I installed Anaconda in my home directory : \home\pranav
Next I ran the command conda just to check if the installation was correct - it turned out to be prefectly fine
When I type in ipython OR ipython notebook , I get the following error :
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 7, in <module>
from IPython import start_ipython
ImportError: No module named IPython
Can someone help me out ? Changing / Adding the PATH Variable is not working as suggested elsewhere on Stack Overflow
What was required was just a clean install of IPython :
pip install ipython
pip install 'ipython[all]'
Works like a charm :)
Ipython is probably not installed. Try running the below commands
conda update conda
conda update ipython ipython-notebook ipython-qtconsole
It was installed in my base environment but not in an newly created Python 3.6 environment so I had to activate it and then run conda install -c anaconda ipython from here: https://anaconda.org/anaconda/ipython
Related
I'm having trouble importing pyGIMLI on Jupyter Notebook. I installed it as recommended on https://www.pygimli.org/installation.html by creating a new environment and the installation went smoothly. However when I try to import it on Jupyter Notebook it cannot load it and I get : "ModuleNotFoundError: No module named 'pygimli'". I launch Jupyter using the terminal after typing the command :
conda activate pg
so I believe it should work (I do the same for Obspy and it works like a charm!).
I found a test command to see if the installation went correctly :
python -c "import pygimli; pygimli.test(show=False, onlydoctests=True)"
I get 2 failures according to the command, however I don't really get what's causing trouble, nor do I get how to solve the problem. Here are two screenshots of the failures I get on the terminal :
First screenshot of the failures
Second screenshot of the failures
I just found out what the problem was : I forgot to install ipykernel in the new environment. I could solve my issue using :
conda install nb_conda
conda install ipykernel
python -m ipykernel install --user --name mykernel
Sorry for my dumb issue and thank you to those who already commented my quesiton!
I've recently installed Anaconda3 32bit version on Windows 10 but Jupyter won't launch.
I've updated anaconda using conda and everything looked ok with all packages including Jupyter downloading.
I've added the path to environmental variables.
I've tried to run jupyter notebook from cmd prompt but still get the same error message.
Trace:
Traceback (most recent call last): File "C:\Users\Edward\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
ModuleNotFoundError: No module named 'notebook.notebookapp'; 'notebook' is not a package
If jupyter is installed on your system you can also use cmd to open i as:
jupyter notebook
If not then u can use pip to install jupyter:
pip install jupyterlab
or
pip install notebook
Then you can use cmd to open.
Maybe you did not download the latest version of Python.
Try downloading Python 3.9 first and see.
You can also download jupyter notebook from your OS terminal.
Thanks, but I have tried these ideas. The root of the problem (pun not intended!) is in the path definitions I think. I have tried adding path definitions. But things that used to work fine like running pip from the C:\ prompt no longer do. So I have given up on Anaconda and now use Visual Studio Code for everything, including running a Jupyter Notebook.
Don't know why the system path definition doesn't work. If I go to the directory containing pip it runs ok.
Many Thanks
Previously when I launched a jupyter-notebook within a conda environment I would have access to the conda environment. I recently started with a clean Anaconda3 (macOS) install and now I can no longer connect to the conda env with jupyter. The issue seems to be related to this issue and this stack-overflow question.
As noted in the comments the question is closely related to this SO question as well. However question is probably closer and none of the answers in either fix my issue.
I would expect after creating and activating a conda env, that either jupyter notebook:
would work out of the box and recognize the environment it was
launched in: this does not happen. the jupyter-notebook doesn't have
access to the modules installed in the new env
or, i would need to
run conda install jupyter in the new environment. the install fails
with ImportError: cannot import name 'ensure_dir_exists'. Note the
traceback does indeed indicate that it is using the correct conda-env
/Users/brook/anaconda3/envs/test2/lib/python3.6/site-packages/notebook/nbextensions.py
I tried the following:
conda update jupyter_core jupyter_client in the base env: this did
not fix any of the problems
conda install jupyter_core jupyter_client
notebook in the new env: these installed correctly but then when i
ran jupyter notebook i got ImportError: cannot import name
'ensure_dir_exists'
conda install nb_conda in the new env but that
also failed with ImportError: cannot import name 'ensure_dir_exists'
conda install nb_conda in the base env: this almost worked - i think.
after launching the notebook the conda tab shows my current env as
the default.
However when creating a notebook i do not see it listed as an option
I thought that since its checked as the default the "Python 3" option would be the current env "test3". However this still didn't work - importing modules give ModuleNotFoundError and double checking at the command line the modules are correctly installed.
Finally. I should note that recently I did a Unix install on a cloud instance and running conda install jupyter in the new env worked as expected.
For those who made it this far, some details:
macOS (10.11.6)
i tried the graphical-installer, also the cmd line install from the most recent version as well as 5.3.1 and 5.2.0
and ...
Thanks!
I use miniconda to run Python 3.6. Everything was fine until I couldn't start Jupyter notebook. The error message was:
File "/Users/usr/miniconda3/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Users/usr/miniconda3/lib/python2.7/site-packages/notebook/notebookapp.py", line 45, in <module>
ioloop.install()
File "/Users/usr/miniconda3/lib/python2.7/site-packages/zmq/eventloop/ioloop.py", line 210, in install
assert (not ioloop.IOLoop.initialized()) or \
AttributeError: type object 'IOLoop' has no attribute 'initialized'
After a Google search, I tried the following:
conda install tornado=4.5.3
But it gave a warning message:
CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a 2.7.x release that supports hmac.compare_digest as soon as possible.
But I didn't read carefully so I performed it anyway. Now I can open Jupyter notebook, but my Python was downgraded to 2.7 How can I get my Python 3.6 back?! :'(
Thank you in advance!
I solved the issue. Thanks to #C.Nivs and #Feelsbadman. Here is my solution:
I checked my python environment by: conda env list and found out I have a base, a 2.7 and a 3.6 environments existed at the same time, with the base being the default.
I activated my 3.6 env by source activate py36
I created an ipython kernel by conda install notebook ipykernel then ipython kernel install --user
Open jupyter notebook, now there is a Python 2 and Python 3 kernel.
I will try to remove the Python 2 from jupyter notebook since I don't use 2.
Thank you for the help.
I have been fighting with this problem for hours now, and it's a kind of complicated one.
I'm on windows 7, Python 2.7, Spyder 3.2.6
I tried to install OSMNX through cygwin, however I faced many issues. Finally managed to install it through windows cmd.
Through the anaconda prompt, I could import the osmnx with no error.
However, I'm trying to import it in spyder, but I keep receiving:
Traceback (most recent call last):
File "<ipython-input-2-2b99ab66aebb>", line 1, in <module>
import osmnx
ImportError: No module named osmnx
What is exactly wrong here? and how can I solve it?
The problem is the use of different environments for your anaconda prompt and your instance of spyder, as mentioned by #Simon. This problem and the different available solutions are reviewed here: GitHub discussion
You can solve the problem as follows. Provided that you have the package spyder-kernels already installed in your Anaconda prompt environment, run the following command in Anaconda prompt:
python -c "import sys; print(sys.executable)"
and copy the path returned to your console. Then, in Spyder go to Tools>Preferences>Python interpreter. Here you will see two options under Select the Python interpreter for all Spyder consoles. Check the second option and paste the path you copied from the Anaconda prompt. Close Spyder and open it again and now the import module command should work.
By doing this, Spyder will basically use the Python interpreter from the environment in which you have installed the new modules.
You need to sync the environment variables/path for both .
Just go to the anaconda promt and enter the command
> conda install spyder
It will automatically prepare the environment. Following that, just open up spyder and execute your code.
I have faced the same problem. I have installed the Spyder and Jupyter inside the conda environment. After that it's working fine for me.
source activate my_conda_env
conda install spyder
conda install jupyter notebook