Netifaces error after fresh install from source


#1

Hello,
I did a fresh install of the NRP on ubuntu 18.04, following the onstructions on bitbucket. Yesterday, the NRP worked, when I started it with cle-start.
Now it shows this:

setting /run_id to 7fbe5048-fe34-11ea-9ea8-287fcfb968f6
process[rosout-1]: started with pid [3574]
started core service [/rosout]
[2] 3581
[ INFO] [1600931203.396452479]: Waiting For connections on 0.0.0.0:8081
[3] 3602
Traceback (most recent call last):
File “/home/marie/Documents/NRP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/ROSCLESimulationFactory.py”, line 41, in
from hbp_nrp_cleserver.server import ROS_CLE_NODE_NAME, SERVICE_CREATE_NEW_SIMULATION,
File “/home/marie/Documents/NRP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/init.py”, line 31, in
from hbp_nrp_cle import config
File “/home/marie/Documents/NRP/CLE/hbp_nrp_cle/hbp_nrp_cle/config.py”, line 38, in
import netifaces
ImportError: No module named netifaces
[3]+ Exit 1 $HOME/.opt/platform_venv/bin/python $HBP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/ROSCLESimulationFactory.py
[3] 3606
[uWSGI] getting INI configuration from /home/marie/.local/etc/nginx/uwsgi-nrp.ini

and this

— no python application found, check your startup logs for errors —
— no python application found, check your startup logs for errors —
2020-09-24 09:06:47 GMT+0200 Failed to execute request http://localhost:8080/health/errors. ERROR: Error: Status code: 500
Internal Server Error

It says it can’t find the netifaces package. After installing netifaces with apt-get and running
./update_nrp update all
./configure_nrp
it still shows the same error message.


#2

Dear Schwaben,

netifaces==0.8 is required by the CLE component (see $HBP/CLE/hbp_nrp_cle/requirements.txt), and probably you system-wide netifaces was in the way, preventing the build to install its own in the NRP’s virtual env.

So I would suggest removing the apt-get netifaces packages and then rerun the build (you can use ./update_nrp update without the “all” if you don’t want to loose time rebuilding all the 3rd party software like gazebo and nest).

Best regards,
Axel


#3

Hello,
I removed netifaces and ran ./update_nrp update, but it still says no module named netifaces:

setting /run_id to 66f250c2-fe80-11ea-8116-287fcfb968f6
process[rosout-1]: started with pid [11833]
started core service [/rosout]
[2] 11840
[ INFO] [1600963803.568456254]: Waiting For connections on 0.0.0.0:8081
[3] 11861
Traceback (most recent call last):
File “/home/marie/Documents/NRP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/ROSCLESimulationFactory.py”, line 41, in
from hbp_nrp_cleserver.server import ROS_CLE_NODE_NAME, SERVICE_CREATE_NEW_SIMULATION,
File “/home/marie/Documents/NRP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/init.py”, line 31, in
from hbp_nrp_cle import config
File “/home/marie/Documents/NRP/CLE/hbp_nrp_cle/hbp_nrp_cle/config.py”, line 38, in
import netifaces
ImportError: No module named netifaces
[3]+ Exit 1 $HOME/.opt/platform_venv/bin/python $HBP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/ROSCLESimulationFactory.py
[3] 11865
[uWSGI] getting INI configuration from /home/marie/.local/etc/nginx/uwsgi-nrp.in

and

setting /run_id to 66f250c2-fe80-11ea-8116-287fcfb968f6
process[rosout-1]: started with pid [11833]
started core service [/rosout]
[2] 11840
[ INFO] [1600963803.568456254]: Waiting For connections on 0.0.0.0:8081
[3] 11861
Traceback (most recent call last):
File “/home/marie/Documents/NRP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/ROSCLESimulationFactory.py”, line 41, in
from hbp_nrp_cleserver.server import ROS_CLE_NODE_NAME, SERVICE_CREATE_NEW_SIMULATION,
File “/home/marie/Documents/NRP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/init.py”, line 31, in
from hbp_nrp_cle import config
File “/home/marie/Documents/NRP/CLE/hbp_nrp_cle/hbp_nrp_cle/config.py”, line 38, in
import netifaces
ImportError: No module named netifaces
[3]+ Exit 1 $HOME/.opt/platform_venv/bin/python $HBP/ExDBackend/hbp_nrp_cleserver/hbp_nrp_cleserver/server/ROSCLESimulationFactory.py
[3] 11865
[uWSGI] getting INI configuration from /home/marie/.local/etc/nginx/uwsgi-nrp.in

Best regards
schwaben


#4

Hi,

Can you check in $HOME/.opt/platform_venv/lib/python2.7/site-packages if you have netifaces-0.8.dist-info and netifaces.so ?

Regards
Axel


#5

Hello,
I have neither netifaces-0.8.dist-info nor netifaces.so-

Regards
schwaben


#6

Hm. Then let’s “rebuild” the CLE repo, which is supposed to install netifaces.

cd $HBP/CLE
make devinstall

See if it says that it’s downloading netifaces and if there is any error about it.

Regards
Axel


#7

When running make devinstall it shows this error:

Using cached https://files.pythonhosted.org/packages/ea/f1/831fa9763afc85d3065557762824490d6e4d1afe1a56e0f053a568ae0cb5/sortedcollections-1.2.1-py2.py3-none-any.whl
Collecting enum-compat (from spalloc<3.0.0,>=2.0.1->sPyNNaker8->hbp-nrp-cle==3.0.0)
Using cached https://files.pythonhosted.org/packages/41/46/8ed2368976d934652d8f33f1fdd86f5580fab45e890c90a848e83097a093/enum-compat-0.0.3.tar.gz
Collecting tzlocal (from spalloc<3.0.0,>=2.0.1->sPyNNaker8->hbp-nrp-cle==3.0.0)
Using cached https://files.pythonhosted.org/packages/79/8c/7d9608dd2643a144bd473405d268973ee1c67aac4c72c4d73910dc8a4754/tzlocal-3.0b1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-build-HzBxcz/tzlocal/setup.py”, line 1, in
from pathlib import Path
ImportError: No module named pathlib

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-HzBxcz/tzlocal/
You are using pip version 9.0.3, however version 20.2.3 is available.
You should consider upgrading via the ‘pip install --upgrade pip’ command.

and I still can’t find netifaces in $HOME/.opt/platform_venv/lib/python2.7/site-packages.

Regards
schwaben


#8

Ok, add ubuntu package python-pathlib

sudo apt-get install python-pathlib

rerun make devinstall in the CLE directory and copy the lines mentioning netifaces or other issues.


#9

Hi,
I installed python-pathlib and reran make devinstall, but it still shows the same error:

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-CWTtft/tzlocal/setup.py", line 1, in <module>
    from pathlib import Path
ImportError: No module named pathlib

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-CWTtft/tzlocal/

When I type pip list in the terminal, both netifaces 0.10.4 and pathlib 1.0.1 are on that list, although I did not sudo apt-get install netifaces.
Both are installed at /usr/lib/python2.7/dist-packages. That is probably the reason why it can’t import netifaces, but why is it unable to find pathlib?

Regards
schwaben


#10

Maybe there are in the global python packages and were installed with pip for some reason.
Uninstall them:

pip uninstall netifaces pathlib

Then run make devinstall in CLE.


#11

Warning, there was an error in my previous post. I fixed it, but please ignore the email and go to the forum post to see the updated version.


#12

Thank you for your answer.
Uninstalling them with pip uninstall netifaces pathlib doesn’t work

Not uninstalling netifaces at /usr/lib/python2.7/dist-packages, outside environment /usr
Not uninstalling pathlib at /usr/lib/python2.7/dist-packages, outside environment /usr

so they probably weren’t installed using pip. Should I run sudo apt-get purge netifaces pathlib, or would that also remove other dependencies I might still need?

The only fixes I found on the internet for the packages being installed in the wrong directory were adding /usr/lib/python2.7/dist-packages to $PYTHONPATH, which breaks something else according to this post ([SOLVED] Error after fresh install from source) or installing it with pip to a certain location, which might not work because of the conflict of pip and apt-get.

I also noticed that I don’t have $HOME/.local/lib/python2.7/dist-packages folder mentioned in the README.md on bitbucket, but only a $HOME/.local/lib/python2.7/site-packages containing the NEST related stuff. Could that be an issue?


#13

Actually, I also only have the $HOME/.local/lib/python2.7/site-packages. This is not the issue (I’ll change the doc later when we fix this).
First, did you try sudo-ing your pip uninstall command?

sudo pip uninstall netifaces pathlib
sudo apt-get install python-pathlib
cd $HBP/CLE
make devinstall

If no success, let’s try to find where your packages are installed, activate the NRP virtual_env and load the modules and find their location:

source $HOME/.opt/platform_venv/bin/activate
python  # this starts an interactive python within the NRP virtual env
import netifaces
netifaces.__file__   # this should return the path of the .so netifaces library
exit()  # to exit the python interpreter
deactivate   # to get out of the virtual env

#14

sudo-ing pip uninstall didn’t work.
Import netifaces fails with ImportError: No module named netifaces.

If I enter pip show netifaces I get

Name: netifaces
Version: 0.10.4
Location: /usr/lib/python2.7/dist-packages

and some more info. In this folder there are netifaces.so and a folder netifaces-0.14.4.egg-info.
With apt list --installed I get
python-netifaces/bionic,now 0.10.4-0.1build4 amd64 [installed,automatic]


#15

Hi,

Obviously the system netifaces was not removed. Something went wrong with the apt-get remove python-netifaces.
I tried it on my computer (cause I have both the system and NRP versions of netifaces). If I try to apt-get remove python-netifaces, it will uninstall the whole ROS, which we don’t want to do.

Maybe, if system netifaces is hidden from the NRP virtual env, try to activate it before you make devinstall. If it doesn’t find it, it will for sure download the 0.8 version into $HOME/.opt/platform_venv.

source $HOME/.opt/platform_venv/bin/activate
cd $HBP/CLE
make devinstall
deactivate

#16

Hi,
make devinstall fails because it can’t find pathlib:

ImportError: No module named pathlib
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-_X6Qsv/tzlocal/

After I installed pathlib with pip in the virtual environment, it showed a new error`

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-2XKUuH/tzlocal/setup.py", line 8, in <module>
        + Path('CHANGES.txt').read_text('utf-8'))
AttributeError: 'PosixPath' object has no attribute 'read_text'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2XKUuH/tzlocal/

The only solution to that seems to be to use python 3.5 (https://github.com/aio-libs/aiohttp/issues/2741).


#17

Hi,
is it possible that the error is caused by using the wrong version of pip, a version >=9?

Regards
schwaben


#18

This sounds like a wrong pathlib version.

I have (in the NRP platform_venv):

  • pip 9.0.3
  • python 2.7.15+
  • pathlib2 2.3.5
  • netifaces 0.8
    In the system (apt packages), I have:
  • pathlib 1.0.1
  • pathlib2 2.3.0
  • netifaces 0.10.4

When you run the NRP, platform_venv packages should override system packages. But to get them installed in platform_venv, the system packages should be hidden, that’s why I suggested to make devinstall from the platform_venv.


#19

Hi, I would also try

source $HOME/.opt/platform_venv/bin/activate
pip install netifaces==0.8
deactivate

and then retriger the installation. Hope it helps!

Best,
Manos


#20

Hi,

I installed netifaces 0.8 om the platform_venv.
If I don’t install pathlib in the platform_venv, I still get this error running make devinstall in the platform_venv
ImportError: No module named pathlib
If I install pathlib, I get

Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-2XKUuH/tzlocal/setup.py", line 8, in <module>
        + Path('CHANGES.txt').read_text('utf-8'))
AttributeError: 'PosixPath' object has no attribute 'read_text'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-2XKUuH/tzlocal/