I wanted to install the numpy package for python 3.5 on my Mac OS High Sierra, but I can't seem to make it work.
I have it on python2.7, but I would also like to install it for the next versions.
Currently, I have installed python 2.7, python 3.5, and python 3.7.
I tried to install numpy using:
brew install numpy --with-python3 (no error)
sudo port install py35-numpy#1.15.4 (no error)
sudo port install py37-numpy#1.15.4 (no error)
pip3.5 install numpy (gives "Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy" )
I can tell that it is not installed because when I type python3 and then import numpy as np gives "ModuleNotFoundError: No module named 'numpy'"
Any ideas on how to make it work?
Thanks in advance.
First, you need to activate the virtual environment for the version of python you wish to run. After you have done that then just run "pip install numpy" or "pip3 install numpy".
If you used Anaconda to install python then, after activating your environment, type conda install numpy.
If running pip3.5 --version or pip3 --version works, what is the output when you run pip3 freeze? If there is no output, it indicates that there are no packages installed for the Python 3 environment and you should be able to install numpy with pip3 install numpy.
Related
System: macOS Mojave 10.14.5
I have both Python 2 and Python 3 installed on my Mac and when I try to install scikit-learn using terminal command:
pip install scikit-learn
It is installed for only Python 2.7 and not Python 3.6 , I wish to install it for both. Is it possible to do the same? And I am not using any virtual environment because I find it really confusing, just in case.
Usually pip is version 2, you need to run pip3 to install for python3
There are multiple ways to install pip3, probably best (and easiest) to install along with python3 by downloading the python3 package: https://www.python.org/downloads/release/python-369/
I however recommend using conda instead.
python3 -m pip install package-name
This will install it for python3
I am new to python and trying to install Numpy package in pycharm but I get an error in return please help me solve this problem I have uploaded a picture of this error.
I attempted to install pip within pycharm interpreter still no luck!
Failed to install NumPy Package
This is because of a mismatch between your version of pip and numpy. See answer. Thus, first you must upgrade your pip:
On Linux or macOS:
pip install -U pip
On Windows:
python -m pip install -U pip
Once pip is updated, you may install numpy.
I have an Ubuntu 16.04 OS with ROS kinetic.
When I open a terminal and type python it loads python 2.7, and as I try to import imutils it says it's not there.
Then, I tried to install it with pip install imutils, but it says: requirment already satisfied in bla/bla/python3.5/bla.
If I open the terminal and type python3, it loads Python 3.5, and when I try to import that lib, it complaints that it can't find cv2, and gives an address pointing to where the Python ROS package is located (Python 2.7).
Up to this point, it makes sense to me (I am aware of the .bashrc loading the ROS packages), but then, how can I install imutils in the Python version of ROS? I want to use the compatible imutils with my ROS Kinetic.
Your problem is that your pip is set to Python 3.5.
So, you can bypass it using pip2 instead:
pip2 install imutils
or
sudo pip2 install imutils
[NOTE]:
Check your pip s link to Python versions assignment:
pip --version
pip2 --version
pip3 --version
sudo pip --version
sudo pip2 --version
sudo pip3 --version
Then choose the desired Python version which assigned to these pip or you can change the pip s link address (a relevant post).
I am trying to get the installation right with python 3, pip and pip3. I am working on a mac and by default. I have Python 2.7.10
python -V
Python 2.7.10
python3 -V
Python 3.5.1
What is the correct order of installation commands to install python3 pip and pip3 so that both pip and pip3 can be linked to python3?
This what I get when I try to see what versions I already have:
$ pip -V
-bash: /usr/local/bin/pip: No such file or directory
$ pip3 -V
pip 7.1.2 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)
I need to get this right so that I can install numpy afterward because now with what I have above this is what I get:
$ pip3 install numpy
Collecting numpy
Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
I have Solved it. as #keithpjolley suggested. I installed anaconda, launched it, and I used the command:
conda install numpy
I let it solve the environment. It gave me an older version of numpy at first so I upgraded:
conda install numpy=1.13
Now everything is working with my code.
I'm attempting to install numpy on python3.5 via :
python3.5 -m pip install numpy
but receive error :
/usr/local/bin/python3.5: No module named pip
Same error for pip3 :
python3.5 -m pip3 install numpy
/usr/local/bin/python3.5: No module named pip3
Reason I'm attempting to install numpy this way is pip3 is pointing to a 3.4 dist-packages dir :
pip3 install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python3.4/dist-packages
Cleaning up..
How to install numpy to Python 3.5 ?
Update:
I decided to use docker in order to install on a clean ubuntu14.04 environment and it worked out of box.
Although using virtual environment is advisable in many use-cases, it is not strictly required. You can have a system python3.5 and a pip installation associated with it.
Note that Python 3.5 is now end-of-life and pip has now dropped support. The final version of pip supporting Python 3.5 was 20.3.4 (Jan 2021).
Download this file: pip-20.3.4-py2.py3-none-any.whl
Bootstrap a pip installation using the wheel file: sudo python3.5 pip-20.3.4-py2.py3-none-any.whl/pip install pip-20.3.4-py2.py3-none-any.whl
Install numpy with python3.5 -m pip install --user numpy
I strongly recommend using a virtual environment and in the case of the scientific Python stack, I further recommend using anaconda. It will save you loads of headaches in the future.
Download anaconda for Python3.5.
Create an environment.
Activate it.
conda install numpy.
Step 2 looks like this:
conda create --name env_name numpy
Step 3 looks like this:
source activate env_name
Step 4 looks like this:
conda install numpy
Now, anytime you want to use numpy or any other dependency in your environment, you just do source activate env_name.
To deactivate, do:
source deactivate