importErrors when coding with rospy
I still have no Idea what I'm doing, so keep in mind that I have no idea on earth what "rebuid your JPMML-SparkML-Package EGG file" means, or what "build your numpy again" means. Coding is evil.
Context
Ubuntu 16.04 LTE, Xenial, Kinetic, python 2.7, anaconda 2, trying to use python files to analyse bagfile messages.
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import numpy as np
import scipy.io
from FileSelectGui import getFilePath
from bag import get_topic_data
testfile = getFilePath("example")
testdata = get_topic_data(testfile,"/NIS")
I've downloaded and installed python, and added to .bashrc:
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
(due to answer: https://answers.ros.org/question/3965... )
I've downloaded and installed anaconda2, and added to .bashrc:
export PATH="/home/pieter/anaconda2/bin:$PATH"
If i don't do the first, I get "importError: rospkg"
If i do the first, I get: "importError: cannot import name multiarray"
All I find about multiarray results is builgin numpy packages and source paths to python, and I can't make heads or tails of it, if I'm honest.
Question
Are the errors arising from contradictions between rospy installations and anaconda installations? Are bashrc lines the cause of this problem? Or, what is it i'm missing?
why?
for now - as long as you don't feel comfortable enough with Python, class/python/search paths, avoid using Anaconda, and use the regular Python (2.7). Things will work out-of-the-box, and you can focus on learning one thing.
There are some work-arounds / workflows that make using Anaconda possible (it essentially comes down to pkgs having been installed for your system Python instead of Anaconda. See #q263430 and #q244644 for related questions.
Python 2.7 is not regular python anymore. This should not be the advice in 2018. Nobody is using Python 2.
That's nice and that is recognised, but the reality is that many ROS packages are not Python 3 compatible.
You have to keep in mind that "ROS packages" includes all packages that are contributed by users.
If they do not upgrade their packages, we cannot blanketly give the advice to use Python 3.
Additionally: Anaconda is not "regular python" either. The issue the OP reports has more to do with the fact that he's using an alternative interpreter than a 2 vs 3 problem.
The suggestion was to use the "system Python", not necessarily "Python 2.7". That was just added to clarify to the OP.