In sklearn\base.py, I have the statement from scipy import sparse.
I am getting this error "no module named scipy".
I tried to install using pip install scipy, but I get so many errors:
libraries mkl_rt not found
openblas not found
lapack not found
no lapacl/blas resources found
etc.
What should I do on Windows?
I found this solution after days.
Firstly which python version you want to install?
If you want for Python 2.7 version:
STEP 1:
scipy‑0.19.0‑cp27‑cp27m‑win32.whl
scipy‑0.19.0‑cp27‑cp27m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win32.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win_amd64.whl
If you want for Python 3.4 version:
scipy‑0.19.0‑cp34‑cp34m‑win32.whl
scipy‑0.19.0‑cp34‑cp34m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win32.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win_amd64.whl
If you want for Python 3.5 version:
scipy‑0.19.0‑cp35‑cp35m‑win32.whl
scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win32.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win_amd64.whl
If you want for Python 3.6 version:
scipy‑0.19.0‑cp36‑cp36m‑win32.whl
scipy‑0.19.0‑cp36‑cp36m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win32.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win_amd64.whl
Link: click
Once the download finished, go to your directory.
For example my directory:
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip install [where/is/your/downloaded/scipy_whl.]
After that installation
STEP 2:
Numpy+MKL
From same web site based on python version again:
After that use same thing again in Script folder
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip3 install [where/is/your/downloaded/numpy_whl.]
And test it in python folder.
Python35>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Download the scipy wheel file from the following link
https://pypi.python.org/pypi/scipy
Then do pip install with the Downloaded file
pip install <wheel-file>
if required , provide sudo permission
I face same problem when install Scipy under ubuntu.
I had to use command:
$ sudo apt-get install libatlas-base-dev gfortran
$ sudo pip install scipy
on CentOS
$ yum install lapack-devel
$ sudo pip install scipy
numpy should be installed before installing scipy. I face this issue when I was running only with numpy. First install numpy and then install scipy. It worked for me.
pip install numpy
pip install scipy
It will display a message like this.
Requirement already satisfied: numpy>=1.8.2 in
(from scipy)
Hope this would be helpful. :)
I have never successfully pip'd a scipy install, instead I have found it easier to install all the base dependencies. Check here for your OS
I've never tried this on windows, but the linux installs have always worked for me.
Related
I am very new to python, and this is one of my first projects. I now use PyCharm, but started with Anaconda and jupyter notebook. When i try to import a module into my project, i get this error:
import stdiomask
stdiomask.getpass('Password: ')
/Users/Kristoffer/.conda/envs/Prosjekt_beginner/bin/python "/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler/modultest.py"
Traceback (most recent call last):
File "/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler/modultest.py", line 1, in <module>
import stdiomask
ModuleNotFoundError: No module named 'stdiomask'
After searching the internet for answers, I am still lost, but suspect it has something to do with my pythonpath. Anaconda might also have something to do with it. As I said I just started with python, so I do not know whether this is enough information to solve my problem, but this is what i did:
Checking if the module is installed with both pip and pip 3:
(base) KKWs-MBP-2:~ Kristoffer$ pip install stdiomask
Requirement already satisfied: stdiomask in ./opt/anaconda3/lib/python3.8/site-packages (0.0.6)
(base) KKWs-MBP-2:~ Kristoffer$ pip3 install stdiomask
Requirement already satisfied: stdiomask in /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages (0.0.6)
WARNING: You are using pip version 20.2.3; however, version 20.3.1 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9 -m pip install --upgrade pip' command.
And then i checked which version of python I am using and got two different answers.
(base) KKWs-MBP-2:~ Kristoffer$ python
Python 3.8.3 (default, Jul 2 2020, 11:26:31)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
(base) KKWs-MBP-2:~ Kristoffer$ python3
Python 3.9.0 (v3.9.0:9cf6752276, Oct 5 2020, 11:29:23)
[Clang 6.0 (clang-600.0.57)] on darwin
I then typed in this in PyCharm and got:
import sys
print(sys.path)
/Users/Kristoffer/.conda/envs/Prosjekt_beginner/bin/python "/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler/modultest.py"
['/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler', '/Users/Kristoffer/Desktop/Pycharm prosjekter/moduler', '/Users/Kristoffer/.conda/envs/Prosjekt_beginner/lib/python38.zip', '/Users/Kristoffer/.conda/envs/Prosjekt_beginner/lib/python3.8', '/Users/Kristoffer/.conda/envs/Prosjekt_beginner/lib/python3.8/lib-dynload', '/Users/Kristoffer/.conda/envs/Prosjekt_beginner/lib/python3.8/site-packages']
So As You Said You are using Anaconda So when you are doing pip3 install stdiomask or pip install stdiomask you are installing it on your real python enviroment & as you mentioned you are using anaconda enviroment,
so give this command conda install stdiomask
Or visit This Website And Read...
I Hope it Helped
Jai Hind Jai Bharat
Unfortunately, when using pip or pip3 to install packages, these are python modules, but also binaries, and using them like:
pip install <package>
or
pip3 install <package>
Doesn't explicitly tell you which interpreter pip is pointing to. However, executing a module using python -m <module> uses the python in your path, and is explicit. You've already seen that the pip -V site-packages is different than your interpreter's site-packages. The way to get around this is to use pip as a module:
python -m pip install <package>
Then you know that you are using the python that you currently have activated
The single line that I am trying to run is the following:
from PIL import Image
However simple this may seem, it gives an error:
Traceback (most recent call last):
File "C:\...\2014-10-22_12-49.py", line 1, in <module>
from PIL import Image
File "C:\pyzo2014a\lib\site-packages\PIL\Image.py", line 29, in <module>
from PIL import VERSION, PILLOW_VERSION, _plugins
ImportError: cannot import name 'VERSION'
In case that's helpful, I installed pillow from https://pypi.python.org/pypi/Pillow/2.6.1 (file Pillow-2.6.1.win-amd64-py3.4.exe) before running this (before that there was already som PIL install, which I uninstalled). The script is run in Pyzo with Python version 3.4.1.
What is going wrong, how can I import Image?
I had the same error. Here was my workflow. I first installed PIL (not Pillow) using
pip install --no-index -f https://dist.plone.org/thirdparty/ -U PIL
Then I found Pillow and installed it using
pip install Pillow
What fixed my issues was uninstalling both and reinstalling Pillow
pip uninstall PIL
pip uninstall Pillow
pip install Pillow
I had the same issue, and did this to fix it:
In command prompt
pip install Pillow ##
Ensure that you use
from PIL import Image
I in Image has to be capital. That was the issue in my case.
FWIW, the following worked for me when I had this same error:
pip install --upgrade --force-reinstall pillow
For me, I had typed image with a lower case "i" instead of Image. So I did:
from PIL import Image NOT from PIL import image
If you use Anaconda, you may try:
conda install Pillow
Example
All the answers were great however what did it for me was a combination of uninstalling Pillow
pip uninstall Pillow
Then installing whatever packages you need e.g.
sudo apt-get -y install python-imaging
sudo apt-get -y install zlib1g-dev
sudo apt-get -y install libjpeg-dev
And then using easy_install to reinstall Pillow
easy_install Pillow
Hope this helps others
Install Pillow from Command Line:
python -m pip install pillow
The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A version for 3.X will be released later.
Python Imaging Library (PIL)
Your python version is 3.4.1, PIL do not support!
In Ubuntu OS, I solved it with the followings commands
pip install Pillow
apt-get install python-imaging
And sorry, dont ask me why, it's up to me ;-)
had the same error while using pytorch code which had deprecated pillow code. since PILLOW_VERSION was deprecated, i worked around it by:
Simply duplicating the _version file and renaming it as PILLOW_VERSION.py in the same folder.
worked for me
I had the same problem, pillow was installed with an environment.yml in anaconda
I am quickly learning that pip and setuptools must always be up to date or I will have problems. Always update these tools before installing packages.For any package import problem uninstall the package upgrade the listed tools(maybe even your base environment) and reinstall.
conda uninstall pillow
python -m pip install pip --upgrade
pip install setuptools --upgrade
pip install pillow
If using Anaconda, from the base environment first run the following before installing packages/environments:
conda update conda
Updating the base env is not required to fix this issue but is a good practice to avoid similar problems
#theeastcoastwest touched on the pip upgrade in their answer but I felt more information was needed
If you've got different Python versions, be sure to install it with the version, you start the script:
python3.9 -m pip install pillow --upgrade
After a lot of googling and different solutions, this is the most efficient, I found.
I am also facing same error, just try to uninstall and resinstall
#uninstall and resinstalltion cmds
pip uninstall pillow
pip uninstall PIL
pip install pillow
Pillow installation link basics link
Using jupyter note book do this below follwing installationa and verified the code as shown below
pip install pillow
#(or)
pip install PIL
import PIL
print(PIL.__version__)
'8.4.0'
(Or) You are using command prompt installation then follow below instruction for windows. Personally suggest this below method.
Microsoft Windows [Version 10.0.19043.1348]
(c) Microsoft Corporation. All rights reserved.
>pip install pillow
Requirement already satisfied: pillow in c:\users\admin\appdata\roaming\python\python310\site-packages (9.0.0)
>python
Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
>>> (PIL.__version__)
'9.0.0'
>>> quit()
do from PIL import Image, ImageTk
If you did all and it didn't work again like mien, do this
copy Image.py and ImageTk.py from /usr/lib/python3/dist-packages/PIL on ubuntu and C:/Users/yourComputerName/AppData/Local/Programs/Python/Python36/Lib/PIL on windows to your projects directory and just import them!
Any library/package you import must have its dependencies and subordinate parts in the same python directory. in linux if you
Python3.x -m pip install <your_library_name_without_braces>
what happens is, it installs on the default python. so first make sure that only 1 python 2.x and 1 python 3.x versions are on your pc.
If you want to successfully install matplotlib
you need these lines,
python -m pip install matplotlib pillow numpy pandas
the last 2 were auxiliary libs, and must have.
what that worked for me:
go to the fodler
C:\Users\{YOUR PC USER NAME}\AppData\Local\Programs\Python\Python37-32\Lib\site-packages
and either delete or change the name of the PIL folder and DONE.
had to do it after running
pip uninstall PIL
as other suggested yielded for me
WARNING: Skipping PIL as it is not installed.
But I am not sure about the consequences of removing that library so I will edit this post if I ever get into a problem because of that.
Now, I actually did some debugging with my brother and found that Pillow (PIL) needed to be initialized. I don't know how to initialize it, so you could probably stick with reinstalling Pillow.
Try import PIL instead of from PIL import image.
I am using Python 2.7 and trying to get PyBrain to work.
But I get this error even though scipy is installed -
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/PyBrain-0.3.1-
py2.7.egg/pybrain/__init__.py", line 1, in <module>
from pybrain.structure.__init__ import *
File "/usr/local/lib/python2.7/site-packages/PyBrain-0.3.1-py2.7.egg/pybrain/structure/__init__.py", line 1, in <module>
from pybrain.structure.connections.__init__ import *
File "/usr/local/lib/python2.7/site-packages/PyBrain-0.3.1-py2.7.egg/pybrain/structure/connections/__init__.py", line 1, in <module>
from pybrain.structure.connections.full import FullConnection
File "/usr/local/lib/python2.7/site-packages/PyBrain-0.3.1-py2.7.egg/pybrain/structure/connections/full.py", line 3, in <module>
from scipy import reshape, dot, outer
ImportError: No module named scipy
I have installed scipy using this command -
sudo apt-get install python-scipy
I get -
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-scipy is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
What should I do?
Try to install it as a python package using pip. You said you already tried:
sudo apt-get install python-scipy
Now run:
pip install scipy
I ran both and it worked on my Debian-based box.
To ensure easy and correct installation for python use pip from the get go
To install pip:
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python2 get-pip.py # for python 2.7
$ sudo python3 get-pip.py # for python 3.x
To install scipy using pip:
$ pip2 install scipy # for python 2.7
$ pip3 install scipy # for python 3.x
For windows users:
I found this solution after days. Firstly which python version you want to install?
If you want for Python 2.7 version:
STEP 1:
scipy‑0.19.0‑cp27‑cp27m‑win32.whl
scipy‑0.19.0‑cp27‑cp27m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win32.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win_amd64.whl
If you want for Python 3.4 version:
scipy‑0.19.0‑cp34‑cp34m‑win32.whl
scipy‑0.19.0‑cp34‑cp34m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win32.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win_amd64.whl
If you want for Python 3.5 version:
scipy‑0.19.0‑cp35‑cp35m‑win32.whl
scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win32.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win_amd64.whl
If you want for Python 3.6 version:
scipy‑0.19.0‑cp36‑cp36m‑win32.whl
scipy‑0.19.0‑cp36‑cp36m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win32.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win_amd64.whl
Link: [click[1]
Once finish installation, go to your directory.
For example my directory:
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip install [where/is/your/downloaded/scipy_whl.]
STEP 2:
Numpy+MKL
From same web site based on python version again:
After that use same thing again in Script folder
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip3 install [where/is/your/downloaded/numpy_whl.]
And test it in python folder.
Python35>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>>import scipy
I had a same problem because I installed both of python2.7 and python3. when I run program with python3 I received same error.
I install scipy with this command and problem has been solved:
sudo apt-get install python3-scipy
if you are using pycharm go to settings and in project interpreter sub-tab click on "+" sign next to list and in the search bar in there search name "scipy" and install the package.
If you need to get scipy in your Python environment on Windows you can get the *.whl files here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
Remember that you need to install numpy+mkl before you can install scipy.
https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
When you have downloaded the correct *.whl files just open a command prompt in the download directory and run pip install *.whl.
For Windows User :
pip install -U scipy
I recommend you to remove scipy via
apt-get purge scipy
and then to install it by
pip install scipy
If you do both then you might confuse you deb package manager due to possibly differing versions.
Try to install it as a python package using pip as follows
$ sudo apt-get install python-scipy
If you want to run a python 3.x script, install scipy by:
$ pip3 install scipy
Otherwise install it by:
$ pip install scipy
This may be too basic (and perhaps assumable), but -
Fedora users can use:
sudo dnf install python-scipy
and then (For python3.x):
pip3 install scipy
or (For python2.7):
pip2 install scipy
Your python don't know where you installed scipy. add the scipy path to PYTHONPATH and I hope it will solve your problem.
My problem was that I spelt one of the libraries wrongly when installing with pip3, which ended up all the other downloaded libaries in the same command not being installed. Just run pip3 install on them again and they should be installed from their cache.
Use sudo pip install scipy to install the library so It cannot ask for permissions later
in previous steps by #user5747799, it do not work directly but instead change the URL (https://bootstrap.pypa.io/pip/2.7/get-pip.py) and now spicy work very well on Ubuntu 20.04
Also o follow steps to switch between version from https://www.fosslinux.com/39384/switching-between-python-2-and-3-versions-on-ubuntu-20-04.htm
To install pip using alternative URL:
$ wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
$ sudo python2 get-pip.py.2 # for python 2.7 (or verify the result of previous step)
$ sudo python3 get-pip.py # for python 3.x
To install scipy using pip:
$ pip2 install scipy # for python 2.7
$ pip3 install scipy # for python 3.x
in order to verify
$ python
then
>>> import scipy
with no errors to show.
for Mac run below command to install scipy
$ brew install scipy
$ pip install scipy
Try forcing a reinstall of scipy:
python3 -m pip install scipy --force-reinstall
for python3 below command to install scipy
python3 -m pip install scipy
I have installed Python 3.3.3 with a command:
sudo apt-get install python3
I am calling it as Python3, because I have Python 2.7 installed as well.
I have also installed distribute (setuptools) with a command:
sudo apt-get install python3-setuptools
To be sure, setuptools are installed for python3, I have searched with pip3 and I received an output:
$ pip3 search setuptools
setuptools - Easily download, build, install, upgrade, and
uninstall Python packages
INSTALLED: 2.0 (latest)
Now I want to install NLTK's version for Python 3, so nltk3.0a3. I have downloaded it from the official site, and in the folder I ran a standard python installation and received an output:
$ python3 setup.py install
Traceback (most recent call last):
File "setup.py", line 33, in <module>
from setuptools import setup, find_packages
ImportError: No module named 'setuptools'
And in fact, when I go to python3 command line, for that input, I see the output:
>>> help('modules setup')
ez_setup - Bootstrap setuptools installation
setup
unittest.test.test_setups
So there is really no module called setuptools...
Does anyone know what am I doing wrong? Or is there any other way of installing NLTK for python 3? (in apt, there is only NLTK for python 2).
Thanks a lot guys for any effort!
You can use muon or your favorite package manager to install python3-setuptools and an experimental version of nltk supporting Python 3 is available at http://nltk.org/nltk3-alpha/
I suspect you will also need pyyaml and numpy installed for your python 3.
I gave this a try:
muon
check that I have installed python3-setuptools and python3-numpy
sudo pip3 install pyyaml
Having downloaded and unpacked the code from the above link
cd ~/ToolBuild/nltk-3.0a3/nltk-3.0a3
sudo python3 setup.py install
python3
Python 3.3.2+ (default, Oct 9 2013, 14:50:09)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> dir(nltk)
['AbstractLazySequence', 'AffixTagger', 'AlignedSent', 'Alignment', 'AnnotationTask', 'Assignment', 'BigramAssocMeasures', 'BigramCollocationFinder', 'BigramTagger', 'BinaryMaxentFeatureEncoding', 'BlanklineTokenizer', 'BottomUpChartParser', 'BottomUpLeftCornerChartParser', 'BottomUpProbabilisticChartParser', 'Boxer', 'BrillTagger', 'BrillTaggerTrainer', 'CfgReadingCommand', 'ChartParser', 'ChunkParserI',..........
I can't find the correct way to install a local directory as a python package using pip.
(venv) C:\(...)>pip install . --no-index
Ignoring indexes: http://pypi.python.org/simple/
Unpacking c:\users\fsantos\desktop\biskates.com\biskates\forks\django-pipeline
Running setup.py egg_info for package from file:///(...)%5Cforks%5Cdjango-pipeline
Installing collected packages: django-pipeline
Running setup.py install for django-pipeline
Successfully installed django-pipeline
Cleaning up...
(venv) C:\(...)>cd ..
(venv) C:\(...)>python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pipeline
>>> pipeline.__file__
'C:\\(...)site-packages\\pipeline\\__init__.py'
>>>
As you can see pip just copied over the package to site-packages. How can I avoid this, and use the package directly from its source folder?
I'm trying to integrate django-pipeline into my Django project, but I want to add support for Django 1.4 first, so I forked and cloned my fork.
I can also just use:
cd your-local-repo
pip install -e .
or
python setup.py install develop
If you're working in a venv, you can do this:
env/bin/pip install git+file:///path/to/your/git/repo
Or with a branch:
env/bin/pip install git+file:///path/to/your/git/repo#mybranch
You can use pip or pipenv with the following command to install from a local git repo:
pip install git+file:///path/to/your/package#egg=package-name
Note that there are 3 slashes after file: here.
To install from a remote repo use:
pip install git+ssh://git#github.com:Username/Project.git
You can also specify a desired branch like so:
pip install git+ssh://git#github.com:Username/Project.git#master
I just rounded up the previous answers and comments from Quilt and nanounanue and this question. Also posted it here.