BUILD ERROR from pip._internal...ImportError: No module named _internal


#1

upon ./update_nrp update all the following error

-------------------------
ExperimentControl
-------------------------
VIRTUALENV
PYTHONPATH is set: (/home/akshay/Documents/NRP/MUSIC/build_venv/lib/python2.7/site-packages:/home/akshay/Documents/NRP/retina/build/lib:/opt/ros/kinetic/lib/python2.7/dist-packages:/home/akshay/.local/lib/python2.7/site-packages:/home/akshay/.local/lib/x86_64-linux-gnu/python2.7/site-packages:/home/akshay/Documents/NRP/GazeboRosPackages/devel/lib/python2.7/dist-packages:/home/akshay/Documents/NRP/CLE/hbp_nrp_cle:/home/akshay/Documents/NRP/ExperimentControl/hbp_nrp_excontrol:/home/akshay/Documents/NRP/ExperimentControl/hbp_nrp_scxml:/home/akshay/Documents/NRP/ExDBackend/hbp_nrp_backend:/home/akshay/Documents/NRP/ExDBackend/hbp_nrp_cleserver:/home/akshay/Documents/NRP/ExDBackend/hbp_nrp_commons:/home/akshay/Documents/NRP/ExDBackend/hbp_nrp_watchdog:/home/akshay/Documents/NRP/ExDBackend/hbp-flask-restful-swagger-master:/home/akshay/Documents/NRP/VirtualCoach/hbp_nrp_virtual_coach:/home/akshay/Documents/NRP/BrainSimulation/hbp_nrp_music_xml:/home/akshay/Documents/NRP/BrainSimulation/hbp_nrp_music_interface:/home/akshay/Documents/NRP/BrainSimulation/hbp_nrp_distributed_nest) this may cause problems with the virtualenv
virtualenv  -p python2.7 --no-site-packages platform_venv
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in /home/akshay/Documents/NRP/ExperimentControl/platform_venv/bin/python2.7
Also creating executable in /home/akshay/Documents/NRP/ExperimentControl/platform_venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
touch platform_venv/bin/activate
/home/akshay/Documents/NRP/ExperimentControl/platform_venv/bin/pip install  --upgrade pip==1.4.1
Traceback (most recent call last):
  File "/home/akshay/Documents/NRP/ExperimentControl/platform_venv/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal
user_makefile:110: recipe for target 'platform_venv/new-pip.txt' failed
make: *** [platform_venv/new-pip.txt] Error 1
ExperimentControl BUILD ERROR

Any Ideas?

Thanks


[SOLVED] Error after fresh install from source
#2

Same here, what version of pip are you using?


#5

When I try to check the version of the pip in $NRP/ExperimentControl/platform_venv I get the same error.

Traceback (most recent call last):
  File "/home/akshay/Documents/NRP/ExperimentControl/platform_venv/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal

easy_install pip in this platform_venv fixed pip to version 9.0.3. The build all was able to establish the ExperimentControl platform_venv in the build, but it broke on the next subdirectory (BrainSimulation) with the same error. I will try to easy_install pip in all the subdirectory venvs and then see if the build all works.

I first have to use easy_install because pip is broken for the command pip install --upgrade pip==1.4.1


#6

Did you fix it? I ran into the same problem during ./update_nrp build all


#7

Hi,

I also had the same error - it’s all due to pip versioning and the many copies of pip you have on your system.

Check the output of:

whereis pip

likely you have many pip executables spread around in your $PATH with different version.


#8

Hi Jacques,

I have the same problem but did not manage to sort it by looking for different versions of pip.
Could you elaborate a little on how you went about solving it?

My ‘whereis pip’ gives:

pip: /usr/bin/pip /home/jakob/.local/bin/pip2.7 /home/jakob/.local/bin/pip /usr/share/man/man1/pip.1.gz

As far as I can tell they are all v. 9.0.3

Probably related is that the most recent pip version 10.0.1 breaks something with the same ImportError as here, which is why I am using 9.0.3 instead.

I supposed the Build is installing a separate pip which it then wishes to downgrade to 1.4.1, but due to the latest version breaking things, this issue emerges.

I would much appreciate a hint :slight_smile:

Thanks in advance


#9

I solved it now by simply ignoring the pip upgrade and sticking to the latest apt release.

It appears the problem here is that pip has rearranged the location of some files in their latest release, but that update has not reached the official Ubuntu apt repositories yet.
While there should be no problem if using pip as released by pip (I think?), there is a problem when installing Ubuntu’s own pip through apt-get and then upgrading through pip install --upgrade pip. This is because pip doesn’t have access to rearrange system-level files if they have been put there by apt.

For that reason the solution is to either let Ubuntu control everything and stick to the latest release in apt or don’t install pip through apt/uninstall it and get it through get-pip.py or easyinstall.

This should probably be updated in the bitbucket install guide?


#10

I finally also had the problem (not sure what process updated my pip with pip…)
Thanks Jakob for the workaround. I added your solution to the Bitbucket documentation.

Axel


#11

I will just revise my advise with pip:
Don’t use apt’s pip.

Instead:
Uninstall apt’s pip:

sudo apt-get remove python-pip

Download and install using get-pip.py instead

python get-pip.py

If you allow apt’s pip version to stay, any future ‘on-the-fly’ installations or updates of pip will break the system. I believe NRP has one of such actions at some point in the build or configure script, where I couldn’t avoid a crash as long as I was using apt’s pip.