ModuleNotFoundError on venv after upgrade to Ubunbtu 20.04 - python-venv

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.

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

How to install matplotlib 3.2.x on Ubuntu 16.04?

Tried several methods to install matplotlib on Ubuntu 16.04, but failed miserably. First I ran
sudo apt-get install python3-matplotlib, it always installed matplotlib 1.5.1 and I wanted the latest version 3.2.1. So I purged it and ran pip3 install matplotlib and what I got was always the following error
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-hse72gvy/matplotlib/setup.py", line 139
raise IOError(f"Failed to download jquery-ui. Please download "
^
SyntaxError: invalid syntax
which seems to suggest that I must install jQuery-UI. I haven't found any working solutions on the internet. Any more has a tip or solution?

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.

lxml on python-3.3.0 ImportError: undefined symbol: xmlBufContent

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.

My ipython and libraries disabled after installing OS X 10.8 (Mountain Lion)

I have a problem similar to this one below:
Python pip broken after OS X 10.8 upgrade
After installing ML, I can no longer use iPython, SciPy or Matplotlib. I get this error:
Shanes-MacBook-Pro:~ $ ipython
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: ipython==0.14.dev
I have tried the following to fix it:
Using sudo ipython
Installing latest Xcode
Reinstalling SciPy superpack
When I type which python it says it is in /usr/bin/python.
Extra information:
nside /Library/python/2.7/site-packages
Inside there is the following:
DateUtils-0.5.2-py2.7.egg
README
easy-install.pth
nose-1.1.2-py2.7.egg
pika-0.9.5-py2.7.egg
pyzmq-2.2.0.1-py2.7-macosx-10.8-intel.egg
tornado-2.3-py2.7.egg
So with this ML upgrade, it removed my numpy, ipython, etc. And it does not install there anymore like it did with lion. How can I find where it installs too because it seems like it is working when I run the install_superpack shell script.
As an update, I never fixed this specific problem. However, I just downloaded the iPython, SciPy, Matplotlib etc. from Enthought. I answered someone elses question on how to do this here:
How to check whether I have IPython installed on my machine and what sequence to install these libraries?