lxml on python-3.3.0 ImportError: undefined symbol: xmlBufContent - lxml

I am having a hard time installing lxml(3.1.0) on python-3.3.0. It installs without errors and I can see the lxml-3.1.0-py3.3-linux-i686.egg in the correct folder (/usr/local/lib/python3.3/site-packages/), but when I try to import etree, I get this:
from lxml import etree
Traceback (most recent call last):
File "", line 1, in
ImportError: /usr/local/lib/python3.3/site-packages/lxml-3.1.0-py3.3-linux-i686.egg/lxml/etree.cpython-33m.so: undefined symbol: xmlBufContent
I did try to install with apt-get, I tried "python3 setup.py install" and I did via easy_install. I have to mention that I have 3 versions installed (2.7, 3.2.3 and 3.3.0.), but I am too much of a beginner to tell if this has to do with it.
I did search all over, but I could not find any solution to this.
Any help is greatly appreciated!
best,
Uhru

You should probably mention the specific operating system you're trying to install on, but I'll assume it's some form of Linux, perhaps Ubuntu or Debian since you mention apt-get.
The error message you mention is typical on lxml when the libxml2 and/or libxslt libraries are not installed for it to link with. For whatever reason, the install procedure does not detect when these are not present and can give the sense the install has succeeded even though those dependencies are not satisfied.
If you issue apt-get install libxml2 libxml2-dev libxslt libxslt-dev that should eliminate this error.

Related

rqt_graph pyqt binding of qt_gui_cpp library

I am using ROS-melodic in ubuntu 18.04 LTS. I am getting this error:
Could not import "pyqt" bindings of qt_gui_cpp library - so C++ plugins will not be available:
Traceback (most recent call last):
File "/opt/ros/melodic/lib/python2.7/dist-packages/qt_gui_cpp/cpp_binding_helper.py", line 43, in <module>
from . import libqt_gui_cpp_sip
ImportError: dynamic module does not define module export function (PyInit_libqt_gui_cpp_sip)
however I have installed pyqt5 and pydot manually, rqt_graph shows up but with this warning. I want to know what can I do to get it right? Is this going to be problem in future? Now rqt_graph is loading but I don't know if this will mess up/create lacking in the graph?
Try uninstalling double packages if any using
pip3 uninstall PyQt5-sip PyQt5
Then try importing it in python3 to check if any other version is there.
If the import is successful then try running the command again
rosrun rqt_graph rqt_graph
if still some error exists install
pip3 install PyQt5==5.12

ModuleNotFoundError on venv after upgrade to Ubunbtu 20.04

I've just upgraded my home server OS to Ubuntu 20.04 and having funny problems.
It seems like somehow python's PATH information is messed up.
Traceback (most recent call last):
File "/home/myname/dirname/venvname/bin/pip3", line 6, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip'
After brief research, I've figured out Ubuntu 20.04 dropped support on Python2.
So I installed Python2 and pip manually and tried the above command again, but still throwing the same error.
Traceback (most recent call last):
File "/home/myname/dirname/venvname/bin/gunicorn", line 6, in <module>
from gunicorn.app.wsgiapp import run
ModuleNotFoundError: No module named 'gunicorn'
Moreover, It throws the same kind of error for Gunicorn.
So, I believe this is not a problem just related to Python2.
I know it is insufficient information for diagnostic, but I have no idea what would be helpful.
So any guess or ask for additional information would be appreciated.
EDIT 1) I've reinstall python on venv with
sudo apt purge python3
sudo apt install python3
and still have the same problem.
Does python3 -m pip works? I am not sure if it would work, but I resolved this kind of error by invoking pip like this previously.
After some tries, I've give up the original venv and make a new one. There was some chore to setup venv and project again, but it works just fine.
If anyone has the same issue, consider re-make another venv.

TensorFlow pip installation issue: cannot import name 'descriptor'

I'm seeing the following error when installing TensorFlow:
ImportError: Traceback (most recent call last):
File ".../graph_pb2.py", line 6, in
from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor'
This error signals a mismatch between protobuf and TensorFlow versions.
Take the following steps to fix this error:
Uninstall TensorFlow.
Uninstall protobuf (if protobuf is installed).
Reinstall TensorFlow, which will also install the correct protobuf dependency.
I faced the similar issue, after trial and error, I used the below logic to run the program:
pip install --upgrade --no-deps --force-reinstall tensorflow
This will make sure to uninstall and reinstall the program from fresh. It works!
I would be extra careful before uninstalling/reinstalling other packages such as protobuf. What I think would most likely be the issue is difference in versions. As of writing this, the most recent release of python is 3.7 while tensorflow is only compatible up to 3.6.
If you're using a 3rd party distribution like Anaconda, this can get hidden from you. In this case I would recommend creating a new environment in Anaconda, with python 3.6 and then installing tensorflow: https://conda.io/projects/conda/en/latest/user-guide/getting-started.html#managing-python
Try this:
pip uninstall protobuf
brew install protobuf
mkdir -p
/Users/alexeibendebury/Library/Python/2.7/lib/python/site-packages
echo 'import site;
site.addsitedir("/usr/local/lib/python2.7/site-packages")' >>
/Users/alexeibendebury/Library/Python/2.7/lib/python/site-packages/homebrew.pth

Python can't import requests, numpy

I downloaded a Python 3.5 application which needs to import requests, overpy, numpy and tk. So, when I try to import, say, requests, I get:
Traceback (most recent call last): File "", line 1, in
ImportError: No module named 'requests'
I have searched the internet for answers and the best I could find is in this link getting error for importing numpy at Python 3.5.1 . I do have other versions installed, 2.7 is installed by default, however knowing where the problem is doesn't offer a solution.
If it is relevant to configuration issues, I have a Mac with El Capitan.
Do you have pip installed? It's likely that you don't have the package readily available. You will need to download pip for your operating system (if you haven't already), then run
pip install requests
http://docs.python-requests.org/en/master/user/install/
If you have pip installed and think you have requests installed as well, then run
pip freeze
It's most likely not an issue with your python versions, though you will want to be sure when you install pip that it is installed in the correct location.

Pillow installed but not identified (Mac OS Yosemite)

I Installed pillow using brew, and when I try to repeat the isntallation I see it's there:
brew install Homebrew/python/pillow
Warning: pillow-2.7.0 already installed
But when I try to load it into a script I get an error:
ImportError: No module named Image
Any suggestions?
python usually looks for Pillow under normal site package installs. Here's what I would do to get a minimal Pillow setup where python should be guaranteed to see it:
sudo easy_install pip
pip install Pillow
I think it may also be possible to just do:
sudo easy_install Pillow
but pip is a bit more user friendly if you're planning on using more python scripts that might have dependencies.
Note: another issue you might be running into is if you're trying to use the Homebrew python but are ending up using the base OSX install of it instead. Make sure which python is showing you what you expect it to be.