Python importing the wrong version of a library outside of virtualenv
Need help updating python package.
I have an implementation that requires the following import
from twisted.internet.ssl import optionsForClientTLS
"optionsForClientTLS" was added to the twisted framework with version 14 (?). I think the non-virtualenv import is getting a deprecated version. If this import is inside a virtual virtual disk that is rolled up via pip, everything is fine. The import goes outside the virtualenv.
In virtualenv
twistd --version
Shows 15.2.1. On a bare system, this shows 13.2.0.
pip install twisted
....
pip freeze
shows
Twisted==15.2.1
Removing the twisted using a pipette and reinstalling did not help. You can install twisted from apt-get with
sudo apt-get install python-twisted
and it installs an older version, but after cleaning and installing using just pip, I still get the older version.
source to share
I solved the problem badly. This was a few days ago, so the paths may not be entirely correct.
The assumption that there were two python packages was correct (I think.) I suspect the order of the paths in the PYTHONPATH means the wrong version was imported first, and pip in the version that was later included in the track.
My "solution" was to copy the twisted directory from the latest version to the older version. It was either from usr/local/lib/python...
before usr/lib/python...
or from ... site-packages
before ... dist-packages.
. I can check again if anyone has one problem and cannot fix it.
source to share