5

I'm working with Python 3.5.1 on a computer having CentOS Linux release 7.3.1611 (Core) operating system.

I have to install the numpy package.

I tried to follow these instructions, by running the command:

sudo yum -y install python34-setuptools

Unfortunately, I got the following error:

Transaction check error:
  file /usr/lib64/libpython3.so from install of python34-libs-3.4.5-4.el7.x86_64 conflicts with file from package python3-libs-3.3.2-12.el7.nux.x86_64

Any idea on how to solve this problem? Thanks

EDIT: On my machine, I have both Python2.7 and Python3.5, and I want to keep them both

DavideChicco.it
  • 3,318
  • 13
  • 56
  • 84
  • have you tried `sudo yum install python3-numpy`? Package name might be different but that's how I installed it on Ubuntu via aptitude – Robbie Milejczak Nov 15 '17 at 19:57
  • 1
    would don't you install it via `pip`? – StegSchreck Nov 15 '17 at 19:59
  • @StegSchreck on Linux systems the native package manager is preferred, unless you need to install to a specific project or get a previous version of a package – Robbie Milejczak Nov 15 '17 at 20:01
  • 1
    Possible duplicate of [Install numpy on python3.3 - Install pip for python3](https://stackoverflow.com/questions/17443354/install-numpy-on-python3-3-install-pip-for-python3) – Loïc Nov 15 '17 at 20:05
  • 1
    @RobbieMilejczak, if you maintain multiple python projects on the same developer machine, I would prefer to use python's virtualenv and a requirements.txt for each project. This can then be shipped together with the project, which makes tracking the requirements and their versions a lot easier. – StegSchreck Nov 15 '17 at 20:08
  • @Loïc he referenced that question in the comment and specifically said that solution did not help him – Robbie Milejczak Nov 15 '17 at 20:08
  • @StegSchreck yeah I know like I said unless you need to install to a specific project. I was just answering your question not trying to argue about they are both valid approaches depending on your needs – Robbie Milejczak Nov 15 '17 at 20:15
  • 1
    @RobbieMilejczak, no worries, I just tried to give more aspects for my comment. Choose whatever suits your case best. – StegSchreck Nov 15 '17 at 20:18
  • @RobbieMilejczak he did show the command he ran. He didn't follow the nice answer, which is the one with the most upvotes. – Loïc Nov 15 '17 at 20:34
  • 1
    Please follow this : https://stackoverflow.com/a/33964956/3322400 – Loïc Nov 15 '17 at 20:35
  • That worked, this question can be closed. Thanks – DavideChicco.it Nov 15 '17 at 20:56
  • I knew it ;) please remember to upvote the solution that worked for you. – Loïc Nov 15 '17 at 21:44

1 Answers1

7

They should come pre-compiled with Centos OS, so try with:

sudo yum install numpy scipy.

So you have two option fist one is installing it system wide, like I mentioned they are pre-compiled with Centos OS, so you can Install the complete scipy packages with numpy like this:

sudo yum install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

Or you can use pip for the installation, like this:

python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

Please read the official docs from scipy organization on how to install all the packages on you system.

NOTE:

You are right that system wide installation will install it only for python2.7, so to use it for python3.5 you will install via pip, so do this:

sudo python3 -m pip install --upgrade pip

sudo python3 -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

and I suggest that you install all of this packages, after the installation I've opened my terminal and I've did this:

copser@copser-LIFEBOOK-S751:~$ python3.5
Python 3.5.2 (default, Sep 14 2017, 22:51:06) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import numpy as np
>>> import numpy.f2py as myf2py
>>> 

as you can see I've imported numpy inside python3.5.2 and it is working, I'm using Ubuntu 16.04 it should be the same on Centos OS.

copser
  • 2,523
  • 5
  • 38
  • 73