When I tried to upgrade my APP server from Ubuntu 16.04 to 18.04 with Python Django application after upgrade Python virtual env is giving the below error for the ./manage.py runserver command.
"ImportError: cannot import name _remove_dead_weakref"
For solving this error I have done the below fix:
cd my-virtualenv-directory
virtualenv . --system-site-packages
The option --system-site-packages was needed because the application uses python-gtk from Ubuntu. I gues in most other cases it is not needed.
Now after that the first error had gone and the below came up:
ImportError: /environment-path/virt-env/local/lib/python2.7/site-packages/lxml/etree.so: undefined symbol: PyFPE_jbuf
For solving this error I have done the below fix:
sudo pip install --upgrade pyOpenSSL cryptography
sudo pip uninstall lxml (Optional if needed only lxml is installed)
sudo rm -rf /environment-path/virt-env//local/lib/python2.7/site-packages/lxml /environment-path/virt-env//local/lib/python2.7/site-packages/lxml-3.5.0.dist-info
sudo -H pip install lxml
To check if its good and fine
************************************
source /environment-path/virt-env/bin/activate
cd /Base folder in the uwsgi.ini file.
./manage.py runserver
If there is no error then it seems to be ok.
That is all,
Cheers.
Comments