1

I need to work with python3.4 and numpy. My distribution is Mint 18 and python3.5 is the default python version.

So I installed python3.4. But I can't import the module numpy. I tried with pip, but I read that pip-3.4 is no longer working and pip3 is not helpful, because it is related to python3.

I tried to use sudo apt-get install python3.4-numpy and the terminal response:

Paketlisten werden gelesen... Fertig Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig E: Paket python3.4-numpy kann nicht gefunden werden. E: Mittels des Musters »python3.4-numpy« konnte kein Paket gefunden werden. E: Mittels regulärem Ausdruck »python3.4-numpy« konnte kein Paket gefunden werden.

(means: E: package python3.4-numpy can not be found or something like this)

Then I used the the alias-command alias python=python3.4 and tried it with sudo apt-get install python-numpy, but there isn't a numpy module in the modules list in python3.4, instead it is in python2.7. And if I use sudo apt-get install python3-numpy the module is in python3.5.

I don't want to use a virtualenv. Do you have any ideas how I get the modules into python3.4?

(Sorry for the edit - i uploaded the question to fast.)

1
  • You can always bootstrap pip using this having some python-binary like your 3.4. Using this installed pip allows you to install numpy, but it will be build from the sources (and you need to prepare your system for that; it's all written in the docs; scipy would be a bit worse). I don't recommend it though as the anaconda-approach is 99.9% of times the better one. Every information you provided yet is no reason not to use anaconda. On the contrary: the basic feeling i get is that you would benefit a lot. Commented Nov 30, 2016 at 11:17

1 Answer 1

2

You have expressed interests installing scientific python packages. Consider installing a virtual environment with Anaconda.

Anaconda is a cross-platform python package manager that incorporates pip. Therefore, whatever can be installed with pip and be installed reliably using the Anaconda package manager.

Benefits

Your benefits are twofold. Using conda will:

  1. allow you to install Python 3.4 (or any version) in an isolated environment (preserving your root Python environment, untampered)
  2. install scientific packages including numpy with less headaches

Steps

  1. Download and install Anaconda. Once installed, you will have command line access to a ton of python packages using either conda or pip.
  2. Build a virtual environment with conda create --name myenv python=3.4 numpy

That's it. If you want to install more packages try conda first then pip if not included e.g. conda install scipy pandas or pip install <packagename>.

You can always remove an environment with conda env remove -n <envname>, so virtual environments are a great tool for testing reproducible environments.

Sign up to request clarification or add additional context in comments.

8 Comments

I don't want to use a virtuelenv, because I need it for my scientific work with large files and other modules.
Please clarify your hesitation. Virtualenvs are very common for scientific work. I build and remove them all the time for my work as they do not affect your personal files.
@Mara You don't seem to understand what virtualenv is then! Take your time and read about it. Technically virtualenv and conda environments differ. But the recommendation of anaconda is very very valuable and very scientific! (On windows it's even the recommended path by the numpy/scipy-devs; nothing wrong with using it on Unix too)
Pardon my wording. By "virtualenv" I mean virtual environment for short. I encourage you to consider this because conda really solved a lot of problems. :)
@sascha yes, i'm new to python. but i will try the anaconda - way. thanks.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.