Cannot "pip install mpi4py==2.0.0" in a virtual environment after "sudo apt-get install python-mpi4py "

Issue #101 invalid
Luc Guyot created an issue

My system is Ubuntu 16.04 LTS, I am using pip 10.0.1, python 2.7.12 and virtualenv 16.0.0.

My goal is to install mpi4py==2.0.0 or later in a virtual environment. My problem is that it becomes impossible as soon as python-mpi4py has been installed via apt-get. And I need to install python-mpi4py because it is a dependency of ros-kinetic-desktop, a package that I am using.

If python-mpi4py is not installed, the following sequence of commands is successful:

virtualenv my_venv
source my_venv/bin/activate
pip install mpi4py==2.0.0

Indeed, the output of "pip show mpi4py" contains "Version 2.0.0", the location is the expected one.

Now, if I run

sudo apt-get install python-mpi4py

the installation is successful but the subsequent ouput of "pip show mpi4py" contains this time "Version 1.3.1", the system version installed in /usr/lib/python2.7/dist-packages. Any attempt to upgrade within the virtual environment seems to be successful, but "pip show" and "pip freeze" always" indicate that "Version 1.3.1" is in use, which is actually the case according to my tests.

I don't really know where the problem lies (pip? python-mpi4py package? virtualenv?), so I am not sure to be posting at the correct place and I apologize if it's not appropriate here.

I am completely blocked and I would appreciate any help.

Thanks in advance for your answer.

Luc Guyot.

Comments (8)

  1. Lisandro Dalcin

    This is for sure not an mpi4py issue, I simply have no control over all the package managers that may possible install mpi4py. mpi4py does not tricks the Python search path in any way. All that being said, what's the output of the following commands ?:

    sudo apt-get install python-mpi4py # make sure you have system mpi4py installed
    virtualenv my_venv
    source my_venv/bin/activate
    which python
    pip install mpi4py==2.0.0
    python -m site
    python -c "import mpi4py; print(mpi4py)"
    
  2. Luc Guyot reporter

    This issue has nothing to do with mpi4py and should be closed as irrelevant. The problem is caused by the presence in my PYTHONPATH of a reference to /usr/lib/python2.7/dist-packages, namely some unnoticed easy-install.pth file.

  3. Log in to comment