Importing scipy in iPython gave me:
In [1]: import scipy
-----------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-4dc45f4c0083> in <module>()
----> 1 import scipy
/usr/local/lib/python2.7/site-packages/scipy/__init__.py in <module>()
/usr/local/lib/python2.7/site-packages/scipy/_lib/_ccallback.py in <module>()
ImportError: cannot import name _ccallback_c
In [2]:
Did a complete update of all the files of Anaconda
> conda update --all
and the error remains. Did a complete search on the web and there are similar problems but without solutions. Can you help me?
i am giving you two solutions which might work by my expereince
1. create a virtualenv and install the scipy package in that virtualenv and give path like this
import sys
sys.path.append('/home/shashi/.virtualenvs/venv/lib/python2.7/site-packages/')
import scipy
2.
Download the source code https://github.com/scipy/scipy/archive/v0.18.0-1.zipand unpack it. Open a command window in the folder where the setup.py of the module is located and type
scipy python setup.py install
It looks like scipy is not installed
conda install -c anaconda scipy
Try this and let us know if you receive the error again
Cheers!
Related
I have Python 3.7.3 installed and installed numpy, scipy via pip (cmd -> python -m pip install --user numpy scipy) and am able to import numpy, scipy if I use an admin command prompt to import both numpy and scipy. However, if I don't use an admin cmd prompt, or try to import scipy from the Python shell, I receive traceback errors like the following:
>>> import numpy
>>> import scipy
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
import scipy
ModuleNotFoundError: No module named 'scipy'
Does this traceback error come from not installing scipy in a certain way? Thanks for the help in advance.
When doing checking pip and python versions in cmd, here's my output:
pip --version
pip 19.1 from c:\program files\python37\lib\site-packages\pip (python 3.7)
python --version
Python 3.7.3
Add the location of your python scripts to the Path in Environment Variables.
C:\Users\User_Name\AppData\Roaming\Python\Python37\Scripts
You mentioned that you've already installed the packages. And the packages are stored in the site-packages file inside Python37 folder. So the error must be because you didn't add these to the path.
I'm new to python and Anaconda and I tried to run my code which contains Levenshtein import, however, it shows me this error:
ImportError Traceback (most recent call last)
<ipython-input-1-896847aaaa86> in <module>()
1 import pandas as pd
2 import numpy as np
----> 3 import Levenshtein as lv
4 import math
5 import re
ImportError: No module named 'Levenshtein'
Any recommendations regarding this, I owe you tons of thanks
The error happens because Anaconda does not ship with the Levenshtein package. You'll have to install it.
Usually, you want to install python packages on Jupyter Notebook by using the conda command. I was having trouble installing this package in particular on a Windows, however, simply because Windows Defender held out the process indefinitely.
The way I managed to install it as by using pip in Windows's cmd. First you have to figure out were the python executable from your Notebook is running.
In your notebook:
import sys
{sys.executable}
Copy the path the cell outputs, open the cmd. There, use the following command:
[PASTE THE PATH HERE] -m pip install python-levenshtein
After that you should be able to import Levenshtein.
I'm having trouble loading a package that is installed in my environment and have no idea why..
conda list
fbprophet 0.3.post2 py36_0 conda-forge
When I request for libraries installed in conda, it clearly shows that I have fbprophet installed. Now, when I import it, a ModuleNotFoundError exception is thrown.
from fbprophet import Prophet
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-83be6864a7aa> in <module>()
----> 1 from fbprophet import Prophet
2 import numpy as np
3 import pandas as pd
ModuleNotFoundError: No module named 'fbprophet'
Has anybody run into this issue? What can I do to troubleshoot this?
My suggestion would be creating a virtual environment for your python first, then conda install your package in the virtual environment.
My script was reading from my pip install list where the module fbprophet did not exist. I went back and installed it there and everything worked. Lesson learned.
Always check where your libraries are being read from.
You may have more than one Python installation. Thus you might installed the library in one Python installation and tried to call it from another one. Please let me know if you have more than one Python installation by printing the result os this CMD command where python.
I am new to python, and trying to run this example in Jupyter notebook. Whenever I run following
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.api import SimpleExpSmoothing
It gives me following error
ImportError Traceback (most recent call last)
<ipython-input-5-a15788c08ca7> in <module>()
3 import pandas as pd
4 import matplotlib.pyplot as plt
----> 5 from statsmodels.tsa.api import SimpleExpSmoothing
ImportError: cannot import name 'SimpleExpSmoothing'
Although, I have installed statsmodels (0.8.0) by
pip install statsmodels
like other packages (numpy, pandas etc.). I checked on git, api file contains this method but my api file (obtained through pip) doesn't have this method. Maybe I am not getting the git version (seems latest one) through pip? I am working in windows and I also tried on mac OSX, and result is same. I tried to do a copy/paste attempt for missing files/code in files from git (not a good way) but it doesn't help. I would appreciate your suggestions here.
EDIT
So the solution for Jupyter (thanks to #user333700) is to install master branch directly from git by
pip install git+https://github.com/statsmodels/statsmodels.git
I am extending my question for PyCharm, how can I add a git package within PyCharm? This link does not help.
For future reference another solution which worked for me is to pip install the latest version directly:
pip install statsmodels==0.9.0rc1
First bear with me as I am relatively new to coding. I am trying to import numpy to Jupyter (localhost, webbased) using Python 3 and getting an error.
import numpy as np
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-0aa0b027fcb6> in <module>()
----> 1 import numpy as np
ModuleNotFoundError: No module named 'numpy'
What should I do? Many thanks.
Maybe try download Anaconda and using that as your interpreter. Pretty sure that comes preinstalled with Numpy.
Or check that you are following the correct way for installing the python 3 version: think this might help: Install numpy on python3.3 - Install pip for python3
have you tried !pip install numpy in hte python Notebook cell?
I had the same problem despite correct version of Python and numpy on my Ubuntu. Then I tried something that worked in Google Colab:
!pip install numpy
After that I was able to import numpy without further complications.