omrirz / pyrosenv

Set an environment for easy work with ROS in python without setting things up
MIT License
7 stars 0 forks source link

No problems installing in python3.8, but import not successful #3

Closed plitkey closed 4 years ago

plitkey commented 4 years ago

Great Idea to collect all ros dependencies! I'm having trouble finding the relevant packages for reading rosbags in python3 and this will hopefully solve it all.

"no module named rospy", "no module named std_msgs" is the problem, though no error in installation phase. ... Installing collected packages: more-itertools, attrs, iniconfig, py, toml, pluggy, pyparsing, six, packaging, pytest, pyros-config, pyros-setup, psutil, gnupg, defusedxml, pycrypto, PyYAML, distro, docutils, python-dateutil, catkin-pkg, rospkg, pyrosenv Successfully installed PyYAML-5.3.1 attrs-20.1.0 catkin-pkg-0.4.22 defusedxml-0.6.0 distro-1.5.0 docutils-0.16 gnupg-2.3.1 iniconfig-1.0.1 more-itertools-8.5.0 packaging-20.4 pluggy-0.13.1 psutil-5.7.2 py-1.9.0 pycrypto-2.6.1 pyparsing-2.4.7 pyros-config-0.2.1 pyros-setup-0.3.0 pyrosenv-0.0.4 pytest-6.0.1 python-dateutil-2.8.1 rospkg-1.2.8 six-1.15.0 toml-0.10.1 (baghandler) [pli@zenbook ~]$ python Python 3.8.5 (default, Aug 12 2020, 00:00:00) [GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux Type "help", "copyright", "credits" or "license" for more information.

import pyrosenv Traceback (most recent call last): File "/home/pli/baghandler/lib/python3.8/site-packages/pyrosenv/init.py", line 30, in import rospy ModuleNotFoundError: No module named 'rospy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/pli/baghandler/lib/python3.8/site-packages/pyrosenv/init.py", line 42, in import rospy ModuleNotFoundError: No module named 'rospy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/home/pli/baghandler/lib/python3.8/site-packages/pyrosenv/init.py", line 51, in sys.modules['pyrosenv.std_msgs'] = std_msgs = importlib.import_module('std_msgs') File "/home/pli/baghandler/lib64/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) ModuleNotFoundError: No module named 'std_msgs'

following https://answers.ros.org/question/343260/install-of-the-rospyrosbag-python-libraries-standalone-not-on-ubuntu/ I could install the packages I needed.

omrirz commented 4 years ago

Let's try two things.

  1. without using pyrosenv can you run in some script "from std_msgs.msg import Int16", dows that work?
  2. do you have the following directory: "/opt/ros//lib/python2.7/dist-packages/std_msgs" ?
plitkey commented 4 years ago

I'm using python 3.8 on fedora so I do not have the /opt/ros/distro/lib... directory and currently with the solution from the link I posted on problem description I can import std_msgs. So my problem is solved. Adding more info to your packet - mainly that this is not meant for use without ROS installation would be helpful.

omrirz commented 4 years ago

Added that disclaimer to README