I've installed OpenCV on Linux Mint and I can import it in python
(cv_env)➜ cv_env python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
>>> import cv2
>>> import numpy
>>> import scipy
But when I want to see it in pip freeze, it doesn't appear:
(cv_env)➜ cv_env pip freeze
argparse==1.2.1
caffi==1.0.2
coffee==0.1.0
ffmpeg-python==0.1.6
future==0.16.0
imutils==0.4.3
numpy==1.13.3
pandas==0.20.3
python-dateutil==2.6.1
pytz==2017.2
scipy==0.19.1
six==1.11.0
wsgiref==0.1.2
Also, I tried to import it via PyCharm's Project Interpreter. It wants to installation with pip. (pip install opencv-python and pip install cv2)
When I installed that, I followed these steps
What is the problem that I cannot see?
Those instructions are outdated, and using apt-get puts pieces outside of the virtual environment, where pip won't see them to freeze.
Within a virtual environment, try
pip install --upgrade pip
pip install opencv-python
The --upgrade might not be necessary, but has helped me out of weird pip failures in the past.
Related
i want to install the library telethon
It says i should execute this line of code
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade telethon
The first command works, it has a bunch of warnings but it seems to work.
But the second command says:
ERROR: Could not find a version that satisfies the requirement telethon (from versions: none) ERROR: No matching distribution found for telethon
So what i am doing wrong?
I am using windows
To install a virtual env and your package:
$ python --version
Python 3.6.9
$ python -m venv venv
$ source venv/bin/activate
(venv)$ pip install -U pip setuptools
(venv)$ pip install telethon
(venv)$ python
Python 3.6.9 (default, Jun 13 2020, 20:27:45)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Now try to load telethon:
>>> import telethon
>>> telethon.__version__
'1.23.0'
I have found the solution:
I just have to run VS code editor as "admin"
sudo pip3.6 install pafy
Collecting pafy
Downloading pafy-0.5.3.1.tar.gz
Installing collected packages: pafy
Running setup.py install for pafy ... done
Successfully installed pafy-0.5.3.1
It is Successfully installed pafy-0.5.3.1.
~$ python
Python 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:09:58)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pafy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pafy'
Why no module named 'pafy'?
You ran pip as sudo but you're running python as normal user. Programs run as normal user don't have rights to access super-user's content (sudo).
To verify this, you can run python as super-user and try to import pafy.
$ sudo python
>>> import pafy
You should never use sudo pip install; you could overwrite important stuff.
Use pip install --user <packagename> or install and use virtualenv. I prefer virtualenv.
pip install pafy
This would work
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.
Brew is not able to find dependency inspite of it being installed.
dependency 'urllib2_kerberos' is already installed yet homebrew throws the message
Homebrew does not provide special Python dependencies; install with: pip install urllib2_kerberos
Here are the setup steps:
$ sudo pip2.7 install urllib2_kerberos
Requirement already satisfied (use --upgrade to upgrade):
urllib2_kerberos in
/usr/local/lib/python2.7/site-packages/urllib2_kerberos-0.1.6-py2.7.egg
$ sudo pip2.7 install urllib2_kerberos --upgrade
Requirement already up-to-date: urllib2_kerberos in
/usr/local/lib/python2.7/site-packages/urllib2_kerberos-0.1.6-py2.7.egg
$ brew install post-review
post-review: Unsatisfied dependency: urllib2_kerberos Homebrew does
not provide special Python dependencies; install with: pip install
urllib2_kerberos Error: An unsatisfied requirement failed this build.
Also tried
$ /usr/local/bin/python2.7
It successfully imports
Python 2.7.12 (default, Jun 29 2016, 14:04:44) [GCC 4.2.1 Compatible
Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright",
"credits" or "license" for more information.
>>> import urllib2_kerberos
(Note: post-review is not on http://braumeister.org/ .
I tapped into another formula repo)
Just encountered this problem myself. The solution is making sure the dependencies are available in your path.
In my case, I'm running with Anaconda Python and had anaconda2/bin in my path but not anaconda2/lib.
I added the following to my zshrc:
export PATH="/Users/$ME/anaconda2/lib/python2.7/site-packages:/Users/$ME/anaconda2/lib/python2.7:/Users/$ME/anaconda2/lib:$PATH"
Then source ~/.zshrc (or your respective shell resource file) and you're good.
I am currently using a python package that depends on requests 2.7.0 or greater, but the requests in my system, Ubuntu 14.04, is version 2.2.1. I tried to upgrade via pip:
pip install requests==2.7.0
but it gives me an error, saying:
Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
I tried to upgrade it by using apt-get install --only-upgrade python-requests, but it says that it is already on the latest version (and it's not).
Then I tried to install in a virtual env, but it gives the same message as the pip message above.
Finally, I thought about two options:
1-) Uninstalling via apt-get and then installing via pip - I think it's too risky, since it will uninstall a lot of other packages.
2-) Cloning from github and manually installing via setup.py, but I also fear that it may mess with other packages depending on it
What is the best way to do it? Is there something simple I am missing?
This works for me on Ubuntu 14.04:
~ › sudo apt-get install -u python-requests
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-requests is already the newest version.
python-requests set to manually installed.
0 to upgrade, 0 to newly install, 0 to remove and 15 not to upgrade.
~ › python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.0.1'
>>>
~ › mkvirtualenv test
New python executable in test/bin/python
Installing setuptools, pip, wheel...done.
~ (test) › pip install requests
Collecting requests
Using cached requests-2.9.1-py2.py3-none-any.whl
Installing collected packages: requests
Successfully installed requests-2.9.1
~ (test) › python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.9.1'
>>>
I wonder why your OS/Ubuntu version of requests is 2.2.1, whereas mine is 2.0.1. Have you installed a newer version of requests manually, via some other mechanism than the official python-requests .deb package? As suggested by #wilbur in the comments above, is it possible you have run sudo pip install requests at some point in the past? If so, it might be worth running sudo pip uninstall requests to see if you can get rid of it...
I needed requests >2.10.0 for socks proxy built-in support.
Force uninstall
dpkg --remove --force-depends python-requests breaks apt (even if requests is pip installed).
apt-get install python-requests rolls it back to 2.2.1, the maximum version in trusty repo.
However, yakkety ubuntu repo contains 2.10.0 python-requests, as needed, so i did the following:
apt-add-repository "deb http://us.archive.ubuntu.com/ubuntu/ yakkety main"
apt-get update
apt-get install python-requests # it installs 2.10.0
apt-add-repository -r "deb http://us.archive.ubuntu.com/ubuntu/ yakkety main"
apt-get update
Note! It is essential to do the second apt-get update to remove yakkety index not to execute apt-get upgrade occasionally and break your system.
So now I have the required version.
$ sudo pip2 show requests
---
Name: requests
Version: 2.10.0
Location: /usr/lib/python2.7/dist-packages
Requires: