Python Installing Modules on Mac OS - python

I am new to Python and terminal prompts/installs and I keep running into installation errors when trying to install modules like Pandas.
I have successfully installed "pip install pandas"
I am unable to install this with pip3 however.
Collecting pandas
Could not find a version that satisfies the requirement pandas (from versions: )
No matching distribution found for pandas
I have pip3 installed and python3(this comes with mac os).
I do not understand the conflict between the versions. If I install using pip, its only compatible with python2?
Why wouldnt I be able to install it using pip3 (see error above)?
Am I somehow installing in the wrong directories or not making the correct distinction for python3 and pip3 version compatibility? Thanks for any insight.

As already said in the comments, pip installs modules for python2. Also, you can't run pandas as a command on the shell.
pip3 install pandas works for me, on python3 (v3.7.4), which was installed directly from a Mac installer package on the python website. No 'environment configuration' was required.
>pip3 install pandas
Collecting pandas
Downloading https://files.pythonhosted.org/packages/ab/ba/f97030b7e8ec0a981abdca173de4e727b3a7b4ed5dba492f362ba87d59a2/pandas-1.0.1-cp37-cp37m-macosx_10_9_x86_64.whl (9.8MB)
100% |████████████████████████████████| 9.8MB 2.8MB/s
If you've installed python3 using some different method, then you may need to install packages differently or configure your python installation in some way.

Related

Can all/most python pip packages be installed using pypy3?

I am able to install the python3 package of forexconnect using:
python3 -m pip install forexconnect
but when I try to install it for pypy using:
pypy3 -m pip install forexconnect
I get the following error,
ERROR: Could not find a version that satisfies the requirement forexconnect (from versions: none)
ERROR: No matching distribution found for forexconnect
I have looked through the pypy documentation and can't work out what I need to do now. Perhaps I need to re-compile/rebuild the library but unfortunately my knowledge of python isn't good enough to understand what is probably quite straight-forward.
Please, does anyone know what is going on here and what needs to be done?
forexeconnect does not release a source tarball, so they must build a binary version for each python version they wish to support and upload that to PyPI. Most packages will release a source tarball and upload that to PyPI, then pip install can build the binary package from source. In this case, the package provider (assuming they do not want to release the source) would have to build a version for PyPy, there is nothing pip nor PyPy can do.
To see supported versions by pip try
pip install forexconnect==0
Then you can set specifical version with
pip install forexconnect==versionnumber

Installing VTK with pip

I'm using Python 3.7 on Arch Linux.
I've been trying to install Mayavi with pip but it always fails when installing vtk. So I found out that even when trying to install vtk by itself via pip (which should work) that vtk is really not installing. I get this error:
$ sudo pip3 install vtk
Collecting vtk
Could not find a version that satisfies the requirement vtk (from versions: )
No matching distribution found for vtk
This seems like a very dumb error on my part, but I really can't understand what's going on. VTK should be compatible with Py3 now as far as I know. pip was installed with get-pip.py and everything else has always worked perfectly.
Curiously enough, pip2 install vtk mayavi works.
Any ideas?
PS.: I'm avoiding creating a separate environment for work-related issues.
EDIT
I did the manual approach:
$ wget https://pypi.python.org/packages/13/7f/735fbc0dd78c91ad3693cfdfe5c91603899fc8e24909f935d46d2fde6559/vtk-8.1.0-cp27-cp27mu-manylinux1_x86_64.whl
$ sudo pip3 install vtk-8.1.0-cp27-cp27mu-manylinux1_x86_64.whl
vtk-8.1.0-cp27-cp27mu-manylinux1_x86_64.whl is not a supported wheel on this platform.
Which I don't know what's causing. I've tried to follow this answer but I can't make the first pep command work.
Could not find a version that satisfies the requirement vtk (from versions: )
Among the currently released files there are no binaries for Python 2.7 and there is source code. Either you should try a different version of Python (2.7, 3.4-3.6) or compile/install VTK from sources.
vtk-8.1.0-cp27-cp27mu-manylinux1_x86_64.whl is not a supported wheel on this platform.
You're trying to install a Python 2.7 binary wheel for Python 3.7. That's impossible.
The wheel has not been published on pip yet, you can download and install one from vtk.org directly : https://vtk.org/download/
You can manually compile the VTK version packages you want and put them in the dist-Packages directory.I have a specific method.

how to install openCV_python with no import cv2 error?

I am trying to install the OpenCV-python on my mac and i have used the following:
$pip install opencv-python
which gave me the following error:
$pip install opencv-python
Collecting opencv-python
Using cached opencv_python-3.4.0.12-cp27-cp27m macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting numpy>=1.11.1 (from opencv-python)
Using cached numpy-1.14.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: numpy, opencv-python
Found existing installation: numpy 1.8.0rc1
Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Then i did try the pip install --upgrade matplotlib which didnot change anything. It just show me:
matplotlib 2.2.2 requires backports.functools-lru-cache, which is not installed.
matplotlib 2.2.2 has requirement numpy>=1.7.1, but you'll have numpy 1.8.0rc1 which is incompatible.
As I found many ways to install the openCV-python in the internet like:
https://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/
and I installed on my other mac but i got import cv2 problem alot in my codes.
I will be more than happy if anyone have a good solution or recommendation to install the openCV-python.
Thanks
In summary, macOS comes with the Python preinstalled and you should not mess with the packages installed as some system utilities depend on them.
https://docs.python.org/3.7/using/mac.html
The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.
You should take a look on either venv or virtualenv.
You can read this answer: https://stackoverflow.com/a/41972262/4796844 that will get you through the basics.
In a nutshell, to solve your problem:
$ python3 -m venv ./project-name
$ . ./project-name/bin/activate
$ pip install opencv-python
And to leave the virtual environment, simply:
$ deactivate

pip stuck while "Using cached wheezy.template-0.1.167.tar.gz"

I recently had issues with my local Anaconda version and decided to reinstall it.
I chose the newest version (Anaconda 5.0.1 (Python 3.6)) and started to reinstall all my packages.
There's a problem installing pyimzml package.
To install it, I've tried:
pip install pyimzml
and
pip install git+git://github.com/alexandrovteam/pyimzML.git
Pip always gets stuck during Using cached wheezy.template-0.1.167.tar.gz.
Tried to install wheezy.template as source tarball from PyPI with pip, then it stucks at Processing c:\users\kawu\downloads\wheezy.template-0.1.167.tar.gz.
What can I do?
I solved the problem with the following steps (Windows 10 x64 machine):
Download wheezy.template tarball
Extract it and remove the nthreads=2 within the setup.py code.
Install wheezy.template with the python .\setup.py install command.
Install pyimzml
I tried many ways to install wheezy.template in my machine, like pip by network, pip/easy_install from local file, but the way above was the only way working out. I can not explain why but it works.

Python - pip install not found matching version

I have a machine in CentOS 6.9 which for various reasons I am forced to use, with python2.6.6 . When I try to download a library with pip I try:
sudo -E pip install someLibrary
and I get for pandas for example
Could not find a version that satisfies the requirement pandas (from
versions: ) No matching distribution found for pandas
I suspect that it has to do with the version of python I use and that the repositories have been moved or whatever. Any ideas?
pip install someLibrary
…
No matching distribution found for pandas
Hehe, failed obfuscation. :-))) Next time try harder… if you don't want an answer…
Well, pandas doesn't support Python 2.6, only 2.7+.
Version 0.17.1 seems to be the last one that supported Python 2.6. Install with pip
pip install pandas==0.17.1
or from sources.

Categories