For python 3.2 I used sudo apt-get install python3.2-numpy.It worked.
What to do for python3.3? Nothing I could think of works. Same goes for scipy, etc.
Thanks.
Edit: this is how it looks like
radu#sunlit-inspired:~$ python3
Python 3.3.2 (default, Jul 3 2013, 10:17:40)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
In the solution below I used python3.4 as binary, but it's safe to use with any version or binary of python. it works fine on windows too (except the downloading pip with wget obviously but just save the file locally and run it with python).
This is great if you have multiple versions of python installed, so you can manage external libraries per python version.
So first, I'd recommend get-pip.py, it's great to install pip:
wget https://bootstrap.pypa.io/get-pip.py
Then you need to install pip for your version of python, I have python3.4 so for me this is the command:
python3.4 get-pip.py
Now pip is installed for this version and in order to get libraries for python3.4 I have to use pip like this:
python3.4 -m pip
So if I want to install numpy I'd use :
python3.4 -m pip install numpy
Note that numpy is quite the heavy library. I thought my system was hanging and failing.
But using the verbose option, you can see that the system is fine :
python3.4 -m pip install numpy -v
This may tell you that you lack python.h but you can easily get it :
On RHEL (Red hat, CentOS, Fedora) it would be something like this:
yum install python34-devel
On debian-like (Debian, Ubuntu, Kali, ...) :
apt-get install python34-dev
Then rerun this :
python3.4 -m pip install numpy -v
From the terminal run:
sudo apt-get install python3-numpy
This package contains Numpy for Python 3.
For scipy:
sudo apt-get install python3-scipy
For for plotting graphs use pylab:
sudo apt-get install python3-matplotlib
The normal way to install Python libraries is with pip. Your way of installing it for Python 3.2 works because it's the system Python, and that's the way to install things for system-provided Pythons on Debian-based systems.
If your Python 3.3 is system-provided, you should probably use a similar command. Otherwise you should probably use pip.
I took my Python 3.3 installation, created a virtualenv and run pip install in it, and that seems to have worked as expected:
$ virtualenv-3.3 testenv
$ cd testenv
$ bin/pip install numpy
blablabl
$ bin/python3
Python 3.3.2 (default, Jun 17 2013, 17:49:21)
[GCC 4.6.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
I'm on Ubuntu 15.04. This seemed to work:
$ sudo pip3 install numpy
On RHEL this worked:
$ sudo python3 -m pip install numpy
My issue was the failure to import numpy into my python files. I was receiving the "ModuleNotFoundError: No module named 'numpy'". I ran into the same issue and I was not referencing python3 on the installation of numpy. I inputted the following into my terminal for OSX and my problems were solved:
python3 -m pip install numpy
On fedora/rhel/centos you need to
sudo yum install -y python3-devel
before
mkvirtualenv -p /usr/bin/python3.3 test-3.3
pip install numpy
otherwise you'll get
SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
Related
With a new SD card and Raspbian version Stretch 2018-11-13:
sudo apt install -y python3-pip python3-dev python-virtualenv
virtualenv -p python3.5 --system-site-packages myenv
source myenv/bin/activate
pip3 install --upgrade tensorflow
$ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
/home/pi/myenv/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: compiletime version 3.4 of module 'tensorflow.python.framework.fast_tensor_util' does not match runtime version 3.5
return f(*args, **kwds)
/home/pi/myenv/lib/python3.5/importlib/_bootstrap.py:222: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 432, got 412
return f(*args, **kwds)
>>>
Check if your Python environment is already configured (requires Python 3.4, 3.5, or 3.6):
The version of the tensorflow package that is installed by sudo python3 -m pip install --user --upgrade tensorflow has been upgraded since this question was originally posted. When this answer was last edited it required Python 3.7, 3.8, or 3.9. Check the current version of tensorflow at https://pypi.org/project/tensorflow/ before you install it.
python3 --version
pip3 --version
virtualenv --version
Install these packages if necessary:
sudo apt update
sudo apt install python3 python3-pip
TensorFlow requirements for the Raspbian operating system:
sudo apt update
sudo apt install python3-dev python3-pip
sudo apt install libatlas-base-dev # required for numpy
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install --upgrade virtualenv # system-wide install
Create a new virtual environment by choosing a Python interpreter and making a myenv directory to hold it:
virtualenv --system-site-packages -p python3 myenv
As you mentioned in your question, the python3 package version in Debian Stretch is 3.5.
Install TensorFlow (system install):
sudo python3 -m pip install --user --upgrade tensorflow
Verify the install:
python3 -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
Success: TensorFlow is now installed. Read the tutorials to get started.
I was making a QSS Theme Preview Program in PyQt 5. But, It suddenly stoppped working:
Traceback (most recent call last):
File "core.py", line 1, in <module>
from PyQt5.QtCore import *
ImportError: /usr/local/lib/python3.5/dist-packages/PyQt5/QtCore.so: undefined symbol: PySlice_AdjustIndices
I removed and re-installed qt5-default, python3-pyqt5, and python3-sip, but the error still occurs.
I am using Lubuntu 16.04 LTS (Xenial Xerus) On An Acer Chromebook R11 C738T using Crouton and Python 3.5.1-3 and PyQt 5.11.2. (I'm pretty sure that the version isn't the problem; other people had the same problem with different Python and PyQt versions)
P.S. Some people say that I need Python 3.6+, but when I run sudo apt install python3, apt says python3 is already the newest version (3.5.1-3). Plus, I get error when I try to build it myself.
I had the same problem, I fixed it by upgrading to python 3.6, sorry I can't dig deeper.
I put the steps to update the python from 3.5 to 3.6, in my case I work in Linux mint, but the steps should be the same.
First the installation.
sudo add-apt-repository ppa:jonathonf/python-3.6
sudo apt update
sudo apt-get install python3.6
Now the configuration (To make the system take version 3.6 by default)
!!!WARNING, depending on the version of Linux|distribution, system problems may be caused if you make default another python version!!!
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
update-alternatives --list python3
sudo update-alternatives --config python3
Then install the pip3 again
wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py
I hope it helps you, I'm sorry I can't tell you the cause of the problem, I hope someone tells us, for now it seems to be a PyQt5 bug with this version.
Anyway, good luck.
How can I Download and install numpy and pandapower on the RASPBIAN JESSIE LITE Minimal image based on Debian Jessie? the one without the GUI. And how can I download and install Pip and miniconda on it as well?
um i am pretty sure the commands are the same are they not? Have you searched this up yet? i am sure that if you have another computer you can just search up miniconda and copy the download link and follow the instructions. pip is automatically installed in miniconda and if you dont have it do
sudo apt-get install python-pip
and for numpy do
pip -U install numpy
or
conda install numpy
for pandapower
conda install pandapower
pip -U install pandapower
or if you cant get miniconda with the method above just do
sudo apt-get install python
that will get you python and pip.
Good Luck!!
I've read in the documentation that Python3.4 ships with pip installed. When I try to make a call however I get an error. What am I missing?
U:\>py -V
Python 3.4.2
U:\>py -3.4 -m pip install matplotlib
C:\Python34\python.exe: No module named pip
I've searched everywhere I could and I couldn't find appropriate answer. I don't know how to install numpy so I could use it in Geany with python 3.1.2. It only works for python 2.6.5. I'm new to ubuntu.
edit: I get ImportError: No module named numpy
If python 3.1.2 is installed via python3 package then you could try:
$ sudo apt-get install python3-numpy
Tried the apt-get installation solution above but it didn't work, however, pip did work:
$ sudo pip3 install numpy
Also, here are the install instructions for pip if needed.