Robotics StackExchange | Archived questions

ROS can't find numpy

Hello,

I was trying to launch the turtlebot3world.launch file from turtlebot3gazebo package, but it outputs the following:

started roslaunch server http://marco-TP51:42481/

SUMMARY
========

PARAMETERS
 * /gazebo/enable_ros_network: True
 * /robot_description: <?xml version="1....
 * /rosdistro: melodic
 * /rosversion: 1.14.3
 * /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    gazebo_gui (gazebo_ros/gzclient)
    spawn_urdf (gazebo_ros/spawn_model)

auto-starting new master
process[master]: started with pid [16336]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 86828436-6078-11e9-9932-aced5c629b57
process[rosout-1]: started with pid [16348]
started core service [/rosout]
process[gazebo-2]: started with pid [16351]
process[gazebo_gui-3]: started with pid [16359]
process[spawn_urdf-4]: started with pid [16365]
[ INFO] [1555440639.459944750]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1555440639.460939990]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[ INFO] [1555440639.508931990]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1555440639.510168849]: waitForService: Service [/gazebo_gui/set_physics_properties] has not been advertised, waiting...
Traceback (most recent call last):
  File "/opt/ros/melodic/lib/gazebo_ros/spawn_model", line 31, in <module>
    from tf.transformations import quaternion_from_euler
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf/__init__.py", line 31, in <module>
    from .listener import Transformer, TransformListener, TransformerROS
  File "/opt/ros/melodic/lib/python2.7/dist-packages/tf/listener.py", line 29, in <module>
    import numpy
ImportError: No module named numpy
[spawn_urdf-4] process has died [pid 16365, exit code 1, cmd /opt/ros/melodic/lib/gazebo_ros/spawn_model -urdf -model turtlebot3_burger -x -2.0 -y -0.5 -z 0.0 -param robot_description __name:=spawn_urdf __log:=/home/marco/.ros/log/86828436-6078-11e9-9932-aced5c629b57/spawn_urdf-4.log].
log file: /home/marco/.ros/log/86828436-6078-11e9-9932-aced5c629b57/spawn_urdf-4*.log
[ INFO] [1555440640.992841491, 0.022000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
[ INFO] [1555440641.029005943, 0.056000000]: Physics dynamic reconfigure ready.
[Err] [REST.cc:205] Error in REST request

libcurl: (51) SSL: no alternative certificate subject name matches target host name 'api.ignitionfuel.org'

It's clear to me that ROS has trouble finding numpy. However, I had installed numpy minutes earlier, by doing sudo apt-get install python-numpy. Sure enough, if I do apt search python-numpy it says it's installed:

Sorting... Done
Full Text Search... Done
python-numpy/bionic,now 1:1.13.3-2ubuntu1 amd64 [installed]
  Numerical Python adds a fast array facility to the Python language

Then, I tried opening a python terminal and typing help("modules"). The result for that is:

Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15) 
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> help("modules")

Please wait a moment while I gather a list of all available modules...

ImportError: numpy.core.multiarray failed to import
ImportError: numpy.core.multiarray failed to import
registered capabilities (classes):
 - rosbridge_library.capabilities.call_service.CallService
 - rosbridge_library.capabilities.advertise.Advertise
 - rosbridge_library.capabilities.publish.Publish
 - rosbridge_library.capabilities.subscribe.Subscribe
 - <class 'rosbridge_library.capabilities.defragmentation.Defragment'>
 - rosbridge_library.capabilities.advertise_service.AdvertiseService
 - rosbridge_library.capabilities.service_response.ServiceResponse
 - rosbridge_library.capabilities.unadvertise_service.UnadvertiseService
/usr/lib/python2.7/dist-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated since IPython 4.0.You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)
No handlers could be found for logger "OpenGL.Tk"
INFO:root:Generating grammar tables from /usr/lib/python2.7/lib2to3/Grammar.txt
INFO:root:Generating grammar tables from /usr/lib/python2.7/lib2to3/PatternGrammar.txt
BaseHTTPServer      concurrent          mmap                rqt_tf_tree
Bastion             configobj           mock                rqt_top
CDROM               configparser        modulefinder        rqt_topic
CGIHTTPServer       constantly          move_base           rqt_web
Canvas              contextlib          move_base_msgs      rtabmap_ros
ConfigParser        control_msgs        mpi4py              runpy
Cookie              control_toolbox     mpl_toolkits        rviz
Crypto              controller_manager  mpmath              scandir
Cython              controller_manager_msgs multifile           sched
DLFCN               cookielib           multiprocessing     scipy
Dialog              copy                mutex               secretstorage
DocXMLRPCServer     copy_reg            nacl                select
FileDialog          copyreg             nav_msgs            sensor_msgs
FixTk               costmap_2d          navfn               serial
HTMLParser          crypt               netifaces           service_identity
IN                  cryptography        netrc               sets
IPython             csv                 new                 setuptools
MimeWriter          ctypes              nis                 sgmllib
OpenGL              curses              nntplib             sha
OpenSSL             cv2                 nodelet             shape_msgs
PAM                 cv_bridge           nodelet_topic_tools shelve
PIL                 cvxopt              nose                shlex
PyKDL               cwiid               ntpath              shutil
PyQt4               cycler              nturl2path          signal
PyQt5               cython              numbers             simplegeneric
Queue               datetime            numexpr             simplejson
ScrolledText        dateutil            oauth               singledispatch
SimpleDialog        dbhash              octomap_msgs        singledispatch_helpers
SimpleHTTPServer    dbm                 olefile             sip
SimpleXMLRPCServer  dbus                opcode              sipconfig
SocketServer        decimal             opencv_apps         sipconfig_nd
StringIO            decorator           openpyxl            sipdistutils
TYPES               defusedxml          operator            site
Tix                 diagnostic_analysis optparse            sitecustomize
Tkconstants         diagnostic_common_diagnostics os                  six
Tkdnd               diagnostic_msgs     os2emxpath          smach
Tkinter             diagnostic_updater  ossaudiodev         smach_msgs
UserDict            diff_drive_controller pandas              smach_ros
UserList            difflib             pango               smclib
UserString          dircache            pangocairo          smtpd
_LWPCookieJar       dis                 paramiko            smtplib
_MozillaCookieJar   distutils           parser              snappy
__builtin__         doctest             past                sndhdr
__future__          docutils            pathlib2            socket
_abcoll             dot_parser          patsy               socketserver
_ast                dsextras            pbr                 spwd
_bisect             dumbdbm             pcl_msgs            sqlite3
_bsddb              dummy_thread        pcl_ros             sre
_cffi_backend       dummy_threading     pdb                 sre_compile
_codecs             dwa_local_planner   pexpect             sre_constants
_codecs_cn          dynamic_reconfigure pickle              sre_parse
_codecs_hk          easy_install        pickleshare         ssl
_codecs_iso2022     em                  pickletools         stat
_codecs_jp          email               pipes               statsmodels
_codecs_kr          encodings           pkg_resources       statvfs
_codecs_tw          ensurepip           pkgutil             std_msgs
_collections        enum                platform            std_srvs
_csv                errno               plistlib            stereo_image_proc
_ctypes             et_xmlfile          pluggy              stereo_msgs
_ctypes_test        exceptions          polled_camera       string
_curses             fcntl               popen2              stringold
_curses_panel       filecmp             poplib              stringprep
_dbus_bindings      fileinput           posix               strop
_dbus_glib_bindings find_object_2d      posixfile           struct
_dummy_thread       fnmatch             posixpath           subprocess
_elementtree        formatter           pprint              subprocess32
_functools          fpformat            profile             sunau
_hashlib            fractions           prompt_toolkit      sunaudio
_heapq              ftplib              pstats              symbol
_hotshot            funcsigs            psutil              sympy
_io                 functools           pty                 symtable
_json               future              ptyprocess          sys
_locale             future_builtins     pwd                 sysconfig
_lsprof             gazebo_msgs         py                  syslog
_markupbase         gazebo_plugins      py_compile          tables
_md5                gazebo_ros          pyasn1              tabnanny
_multibytecodec     gc                  pyasn1_modules      talloc
_multiprocessing    gencpp              pyclbr              tarfile
_osx_support        genericpath         pydoc               telnetlib
_posixsubprocess    geneus              pydoc_data          tempfile
_pyio               genlisp             pydot               termios
_pytest             genmsg              pyexpat             test
_random             gennodejs           pyglet              test_trie
_scandir            genpy               pygments            textwrap
_sha                geographic_msgs     pygtk               tf
_sha256             geometry_msgs       pygtkcompat         tf2_geometry_msgs
_sha512             getopt              pylab               tf2_kdl
_snappy             getpass             pyparsing           tf2_msgs
_socket             gettext             pytest              tf2_py
_sqlite3            gi                  python_qt_binding   tf2_ros
_sre                gio                 pytrie              tf_conversions
_ssl                glib                pytz                theora_image_transport
_strptime           glob                pyximport           this
_struct             global_planner      qrcode              thread
_symtable           gmpy                qt_dotgraph         threading
_sysconfigdata      gnupg               qt_gui              time
_sysconfigdata_nd   gobject             qt_gui_cpp          timeit
_testcapi           grp                 qt_gui_py_common    tkColorChooser
_thread             gtk                 queue               tkCommonDialog
_threading_local    gtkunixprint        quopri              tkFileDialog
_tkinter            gzip                random              tkFont
_version            hashlib             re                  tkMessageBox
_warnings           heapq               readline            tkSimpleDialog
_weakref            hgdemandimport      realsense2_camera   tkinter
_weakrefset         hgext               repr                toaiff
_yaml               hgext3rd            reprlib             token
abc                 hmac                resource            tokenize
actionlib           hotshot             resource_retriever  topic_tools
actionlib_msgs      html                rexec               tornado
actionlib_tutorials html5lib            rfc822              trace
aifc                htmlentitydefs      rlcompleter         traceback
amcl                htmllib             robot_localization  traitlets
angles              http                robotparser         trajectory_msgs
antigravity         httplib             roman               trollius
antlr               httplib2            ros                 ttk
anydbm              hyperlink           rosapi              tty
ar_track_alvar_msgs idna                rosauth             turtle
argparse            ihooks              rosbag              turtle_actionlib
array               image_geometry      rosboost_cfg        turtlebot3_example
asn1crypto          image_proc          rosbridge_library   turtlebot3_msgs
ast                 image_publisher     rosbridge_server    turtlebot3_teleop
asynchat            image_rotate        rosclean            turtlesim
asyncore            image_view          roscpp              twisted
atexit              imaplib             roscpp_tutorials    txaio
atk                 imghdr              roscreate           types
attr                imp                 rosdep2             ubjson
audiodev            importlib           rosdistro           umsgpack
audioop             imputil             rosgraph            unicodedata
autobahn            incremental         rosgraph_msgs       unittest
automat             inspect             rosinstall          urdf_parser_py
backports           interactive_markers rosinstall_generator urllib
backports_abc       io                  roslaunch           urllib2
base64              ipaddress           roslib              urlparse
base_local_planner  ipython_genutils    roslint             user
bdb                 itertools           roslz4              uu
binascii            jdcal               rosmake             uuid
binhex              joblib              rosmaster           uuid_msgs
bisect              json                rosmsg              validate
bluetooth           kdl_parser_py       rosnode             vcstools
bond                keyring             rosparam            visualization_msgs
bondpy              keyrings            rospkg              vtk
boost               keyword             rospy               wadllib
bs4                 kobuki_msgs         rospy_tutorials     warnings
bsddb               kobuki_testsuite    rosserial_msgs      wave
bson                laser_assembler     rosserial_python    wcwidth
builtins            laser_geometry      rosservice          weakref
bz2                 launchpadlib        rostest             webbrowser
bzrlib              lazr                rostopic            webencodings
cPickle             lib2to3             rosunit             whichdb
cProfile            libfuturize         roswtf              wiimote
cStringIO           libpasteurize       rqt_action          winreg
cairo               linecache           rqt_bag             wsaccel
calendar            linuxaudiodev       rqt_bag_plugins     wsgiref
camera_calibration  local_planner_limits rqt_console         wstool
camera_calibration_parsers locale              rqt_dep             wx
catkin              logging             rqt_graph           wxversion
catkin_pkg          lsb_release         rqt_gui             xacro
cbor                lxml                rqt_gui_py          xdrlib
cgi                 lz4                 rqt_launch          xlrd
cgitb               macpath             rqt_logger_level    xlwt
chardet             macurl2path         rqt_moveit          xml
chunk               mailbox             rqt_msg             xmllib
click               mailcap             rqt_nav_view        xmlrpc
cmath               map_msgs            rqt_plot            xmlrpclib
cmd                 markupbase          rqt_pose_view       xxsubtype
code                marshal             rqt_publisher       yaml
codecs              marvelmind_nav      rqt_py_common       yocs_ar_pair_approach
codeop              math                rqt_py_console      yocs_cmd_vel_mux
collections         matplotlib          rqt_reconfigure     yocs_localization_manager
colorama            md5                 rqt_robot_dashboard yocs_msgs
colorsys            mercurial           rqt_robot_monitor   yocs_navigator
commands            message_filters     rqt_robot_steering  yocs_velocity_smoother
compileall          mhlib               rqt_runtime_monitor zipfile
compiler            mimetools           rqt_service_caller  zipimport
compressed_depth_image_transport mimetypes           rqt_shell           zlib
compressed_image_transport mimify              rqt_srv             zope

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".

>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named numpy
>>> 
KeyboardInterrupt
>>> 
/usr/lib/python2.7/dist-packages/psutil/tests/__init__.py:1130: UserWarning: couldn't terminate process psutil.Process(pid=18076, name='orted', started='20:54:21'); attempting kill()
  warnings.warn(msg, UserWarning)

Numpy is not listed here, and there are even some errors. What gives? I feel like I messed up something with my python paths or whatever but I don't even know what, let alone how to fix it. Help?

Asked by 1fabrism on 2019-04-16 14:13:30 UTC

Comments

It's clear to me that ROS has trouble finding numpy.

pedantic, but: python is having trouble loading the numpy module. ROS does not load or find anything here.

Asked by gvdhoorn on 2019-04-17 03:39:10 UTC

Answers

Well I seem to have fixed this by typing sudo apt-get --reinstall install python-numpy into a terminal. I don't know if this is just a band-aid over my messed up python installation but oh well.

Also, that other error I got when launching gazebo

[Err] [REST.cc:205] Error in REST request

libcurl: (51) SSL: no alternative certificate subject name matches target host name 'api.ignitionfuel.org'

can be fixed by changing the url line in ~/.ignition/fuel/config.yaml to https://api.ignitionrobotics.org

Asked by 1fabrism on 2019-04-16 15:02:48 UTC

Comments