I’m totally new on python (never too old to learn a new language…) and I met some difficulty around my project : I recovered an old project, written with python 2 and I try to upgrade it to python 3.
This will run on a SLES 12 SP5.
I’ve made some change (pip3 uses, syntax in python scripts) for being compatible with python 3, check the differents modules dependencies loaded (inquirer, paramiko, etc…) with last versions.
When I’m trying to run my scripts, I’ve this error:
File “install.py”, line 25, in
import postgresql
File “/tmp/my_project-4.2.16/data/postgresql.py”, line 12, in
import paramiko
File “./site-packages/paramiko/init.py”, line 22, in
from paramiko.transport import SecurityOptions, Transport
File “./site-packages/paramiko/transport.py”, line 33, in
from cryptography.hazmat.backends import default_backend
File “./site-packages/cryptography/hazmat/backends/init.py”, line 7
_default_backend: typing.Any = None
^
SyntaxError: invalid syntax
As this happens outside of my own script, I don’t see what can be wrong ?
Thanks for the quick answer !
In fact, I copied my project on the /tmp directory, trying to run its installation and so, modules are well in the /tmp paths.
“My” postgresql.py needs paramiko (this was working with it in python2, I’m trying to keep it for the moment)
Thanks also for the quick answer !
I’m using python3, not sure I can use python 3.6 : I tried but, in that case, I need the python36-curses package which is not provided by SUSE (only python3-curses available)
from your terminal or shell? We need to see the version.
If you have a version below 3.6, you need to either upgrade, or manually
downgrade the other library to remove all the variable annotations
causing errors.
Recent versions of pip (9+) will skip versions of dependencies which don’t support your python version. I wonder if you’ve got a really old pip version.
Can you post the output of python3 -m pip --version?
I would, in any case, suggest upgrading to a newer Python version.
Thanks Dominic!
In fact, I have some constraints : final product should be installed on a SLES 12 SP5 and so, I’m not free to install any kind of version
I just see an issue on my server : pip is linked to python3.6.
The ouput of your command shows me that there is no pip module linked to python3.4 but if I do same command with python3.6, I obtain the pip 21.1.2.
After analysis, I have access to python36-pip package through my SUSE account but I have no access to the repository where python3-pip is.
What is the impact of having pip running on python3.6 while I try to get modules compatible with python3.4 ? Does that means “*pip3 install --user cryptography==2.*8” will get the module specifically for python3.6 ?