I am using apollo 3.0, when I run python modules/tools/mapshow/mapshow.py
Traceback (most recent call last):
File "modules/tools/mapshow/mapshow.py", line 21, in
import matplotlib.pyplot as plt
ImportError: No module named matplotlib.pyplot
This script was run in Apollo 2.x but not run in 3.0
python modules/tools/mapshow/mapshow.py
You can install matplotlib by “conda install matplotlib” inside the docker container.
I did run that command, but I get the following error
Executing transaction: failed
ERROR conda.core.link:_execute(502): An error occurred while uninstalling package 'defaults::conda-4.5.4-py27_0'.
OSError(13, 'Permission denied')
Attempting to roll back.Rolling back transaction: done
OSError(13, 'Permission denied')
Permission denied.
You can give the permission for conda by using ' sudo env "PATH=$PATH" '
Try below command.
sudo env "PATH=$PATH" conda install matplotlib
In my case, it works.
@lesun90 ,did @Hyungza 's answer hope you with your question?
Hi,
I try and success install the matplotlib, however, still could not run the mapshow.py
python modules/tools/mapshow/mapshow.py
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "modules/tools/mapshow/mapshow.py", line 21, in <module>
import matplotlib.pyplot as plt
File "/usr/local/miniconda2/lib/python2.7/site-packages/matplotlib/pyplot.py", line 31, in <module>
import matplotlib.colorbar
File "/usr/local/miniconda2/lib/python2.7/site-packages/matplotlib/colorbar.py", line 32, in <module>
import matplotlib.artist as martist
File "/usr/local/miniconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 16, in <module>
from .path import Path
File "/usr/local/miniconda2/lib/python2.7/site-packages/matplotlib/path.py", line 21, in <module>
from . import _path, rcParams
ImportError: numpy.core.multiarray failed to import
and after I install numpy, it get another error
python modules/tools/mapshow/mapshow.py
Traceback (most recent call last):
File "modules/tools/mapshow/mapshow.py", line 21, in <module>
import matplotlib.pyplot as plt
File "/usr/local/miniconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 126, in <module>
from . import cbook
File "/usr/local/miniconda2/lib/python2.7/site-packages/matplotlib/cbook/__init__.py", line 34, in <module>
import numpy as np
File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 160, in <module>
from . import random
File "/usr/local/lib/python2.7/dist-packages/numpy/random/__init__.py", line 99, in <module>
from .mtrand import *
ImportError: /usr/local/lib/python2.7/dist-packages/numpy/random/mtrand.so: undefined symbol: PyFPE_jbuf
It seems this fix going nowhere.
That python script was run fine in apollo 2.x
Hi @lesun90 this error ImportError: /usr/local/lib/python2.7/dist-packages/numpy/random/mtrand.so: undefined symbol: PyFPE_jbuf may occur by having multiple versions of numpy installed.
Refer by https://stackoverflow.com/questions/36190757/numpy-undefined-symbol-pyfpe-jbuf
You can have a try, in my case, it works.
You can find load path of numpy by scripts:
Create /usr/local/bin/python-which
#!/usr/bin/env python
import importlib
import os
import sys
args = sys.argv[1:]
if len(args) > 0:
module = importlib.import_module(args[0])
print os.path.dirname(module.__file__)
Make it executable
sudo chmod +x /usr/local/bin/python-which
python-which numpy
for my case
apollo@in_dev_docker:/apollo$ python-which numpy
/home/tmp/ros/lib/python2.7/dist-packages/numpy
At last, I replaced the numpy from miniconda to ros directory
cp -r /usr/local/miniconda2/lib/python2.7/site-packages/numpy /home/tmp/ros/lib/python2.7/dist-packages/numpy
it works.
refer : https://stackoverflow.com/questions/247770/retrieving-python-module-path
Thank you for your reply, but is ther any other way to fix this problem. All I want to do is run this script in apollo 3.0
python modules/tools/mapshow/mapshow.py
install updated numpy in docker
sudo pip install -U numpy --ignore-installed
then, you can import pyplot library
still not work, are you able to run python modules/tools/mapshow/mapshow.py in apollo 3.0?
@lesun90
Try to copy both numpy and matplotlib directories from miniconda to ros directory:
cp -r /usr/local/miniconda2/lib/python2.7/site-packages/numpy /home/tmp/ros/lib/python2.7/dist-packages/
cp -r /usr/local/miniconda2/lib/python2.7/site-packages/matplotlib /home/tmp/ros/lib/python2.7/dist-packages/numpy
It worked for me. Good luck !
@nandita05 still not work for me
Hi Guys, I am facing the same error.
Could you please clarify if the mapshow is supported in Apollo 3.0
Thank you
@nandita05 Thanks for the help. I was able to fix the error. Steps followed.
sudo env "PATH=$PATH" conda install matplotlib
The above installation upgrades the numpy version which would result in new error due to the different versions of numpy in miniconda and ROS.
Then I copied the miniconda numpy to ros
cp -r /usr/local/miniconda2/lib/python2.7/site-packages/numpy /home/tmp/ros/lib/python2.7/dist-packages/
Now I am able to run mapshow without any issues.
Thank you,
KK
Closing this issue as it appears to be resolved. Please refer to @kk2491 's response. Thanks!