Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from virtualenv, pyros-setup gets wrong location for config file #54

Open
asmodehn opened this issue Apr 21, 2017 · 2 comments
Open

from virtualenv, pyros-setup gets wrong location for config file #54

asmodehn opened this issue Apr 21, 2017 · 2 comments
Assignees
Labels

Comments

@asmodehn
Copy link
Member

Failing Example :

(pyros-ros) alexv@AlexV-Linux:~/Projects/ros_pyros_ws/src/pyros_rosinterface$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import rospy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named rospy
>>> import pyros_setup
>>> pyros_setup.configurable_import().configure().activate()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pyros_setup/__init__.py", line 92, in configure
    """)
  File "/usr/local/lib/python2.7/dist-packages/pyros_config/confighandler.py", line 74, in configure_file
    os.makedirs(os.path.dirname(cfg_filename))
  File "/home/alexv/.virtualenvs/pyros-ros/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/instance'

In that case :

  • we run from a virtualenv
  • we use pyros from an installed location
  • BUT the config file is attempted to be created along the package, instead of going to /usr/var.
@asmodehn asmodehn added the bug label Apr 21, 2017
@asmodehn
Copy link
Member Author

asmodehn commented Apr 21, 2017

Going out of the venv works :

alexv@AlexV-Linux:~/Projects/ros_pyros_ws/src/pyros_rosinterface$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyros_setup
>>> p = pyros_setup.configurable_import().configure().activate()
Re-adding /opt/ros/indigo/lib/python2.7/dist-packages in front of sys.path
Re-adding /home/alexv/Projects/ros_pyros_ws/devel/lib/python2.7/dist-packages in front of sys.path
Re-adding /home/alexv/Projects/ros_pyros_ws/devel/lib/python2.7/site-packages in front of sys.path
Re-adding /home/alexv/Projects/ros_pyros_ws/src/pyros_schemas in front of sys.path
Re-adding /home/alexv/Projects/ros_pyros_ws/src/pyros_rosinterface in front of sys.path
Re-adding /home/alexv/Projects/ros_pyros_ws/src/pyros in front of sys.path
Re-adding /home/alexv/Projects/ros_pyros_ws/src/pyros_schemas_examples/pyros_httpbin in front of sys.path
Re-adding /home/alexv/Projects/ros_pyros_ws/src/pyros_utils in front of sys.path
>>> vars(p.config_handler)
{'name': 'pyros_setup', 'import_name': 'pyros_setup', 'root_path': '/usr/local/lib/python2.7/dist-packages/pyros_setup', 'instance_path': '/home/alexv/Projects/ros_pyros_ws/devel/var/pyros_setup-instance', 'config': <Config {'WORKSPACES': [], 'DISTRO': 'jade'}>, 'default_config': {'WORKSPACES': [], 'DISTRO': 'jade'}}
>>> 

So in that case the instance path was setup in the appropriate place (not along the installed package)...

@asmodehn asmodehn self-assigned this Apr 21, 2017
@asmodehn
Copy link
Member Author

This seems to be a bug in the current release of pyros-config. It is not taking 'dist-packages' as an installed location when coming from a virtualenv (only site-packages is recognized).

After changing, pyros-setup attempts to create into /usr/local/var which I think is the expected behavior.

Anyway, pyros-setup is supposed to be installed in the python environment. so when using from venv, it should be found in venv, and not on system. However creating a venv that uses system packages will find already installed system wide package, and will not reinstall pyros-setup in venv...

an improvement would be to force the install of pyros_setup there...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant