Run multiple Python versions on system

When using CyberPanel on Google Cloud VPS, I have encountered some Python errors:




I believe the reason is that Google Cloud VPS has automatically installed python-urllib3, python-requests ... (generally, interfering with the "python" of the system out of our control)
That made CyberPanel unable to login:

ImportError: can not import name UnrewindableBodyError
I think you should create a new python version for your CyberPanel system to use, (in another location) it will not depend on the python available on the Centos 7 system (python 2.7.5 is too old). Install a newer version of Python like 3.6.5 or 2.7.15, which can be referenced here:

https://danieleriksson.net/2017/02/08/how-to-install-latest-python-on-centos/

Comments

  • edited May 14

    Centos 7. ?

    Yes, Centos 7.(4-5) - Python 2.7.5
  • So, is that feasible or problematic? :)
    When the system's python crashes, the Cyberpanel can still run if it has a separate python program, you can proactively upgrade this seperate python or configure it to use resources more appropriately.
    Sometimes upgrading to a newer version of Cyberpanel, you can get in trouble at step:

    cd /usr/local/CyberCP
    python manage.py makemigrations
    python manage.py migrate
    I believe using a separate Python will fix that
  • So GCP python version is upgraded to 3.x? I noticed that DO also remove Centos 7.4 with 7.5 and it still uses Python 2.7.
  • edited May 15
    I am getting same issue once I do cantos YUM update ! , I think need to give an instruction for the solution to avoid such situation

  • pip uninstall requests
    pip uninstall urllib3
    yum remove python-urllib3
    yum remove python-requests


    yum install python-urllib3
    yum install python-requests
    This should solve your issue, I notice that GCP have not updated python version, just some libraries.
  • edited May 15
    still not accessible how to force cyberpanel using ver 3 ?
    where to change the paths ?


    =======================================================
    Django Version: 1.11.13
    Exception Type: ImportError
    Exception Value:
    No module named 'requests.packages.urllib3'
    Exception Location: /usr/lib/python2.7/site-packages/requests/packages/__init__.py in load_module, line 95
    Python Executable: /usr/bin/python
    Python Version: 2.7.5
    Python Path:
    ['/usr/local/CyberCP',
    '/usr/bin',
    '/usr/lib/python2.7/site-packages/gunicorn-19.8.1-py2.7.egg',
    '/usr/lib64/python27.zip',
    '/usr/lib64/python2.7',
    '/usr/lib64/python2.7/plat-linux2',
    '/usr/lib64/python2.7/lib-tk',
    '/usr/lib64/python2.7/lib-old',
    '/usr/lib64/python2.7/lib-dynload',
    '/usr/lib64/python2.7/site-packages',
    '/usr/lib/python2.7/site-packages']
  • Submit a ticket, will have a look.
Sign In or Register to comment.
Support CyberPanel CyberPanel Discord

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!