0

I cannot install packages using pip install <packagename> because I am behind the security wall.

I need to install python 3.8 in Ubuntu 16.04 server's virtualenv which originally has python 3.5.2

For that, I manually installed virtualenv-20.0.28-py2.py3-none-any.whl on the server after (manually) installing all its dependencies. Then I created a virtualenv by virtualenv pytorch (pytorch is the name of virtual env) and activated it by source pytorch/bin/activate.

Now I am in the env mode

(pytorch) user@ubuntu:~/my_packages$

when I did pip install Python-3.8.0.tgz it output the below error:

Processing ./Python-3.8.0.tgz
ERROR: Command errored out with exit status 1:
 command: /home/user/my_packages/pytorch/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-9npp4vja/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-9npp4vja/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-1d52yt0i
     cwd: /tmp/pip-req-build-9npp4vja/
Complete output (9 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-req-build-9npp4vja/setup.py", line 2433, in <module>
    main()
  File "/tmp/pip-req-build-9npp4vja/setup.py", line 2392, in main
    set_compiler_flags('LDFLAGS', 'PY_LDFLAGS_NODIST')
  File "/tmp/pip-req-build-9npp4vja/setup.py", line 85, in set_compiler_flags
    sysconfig.get_config_vars()[compiler_flags] = flags + ' ' + py_flags_nodist
TypeError: Can't convert 'NoneType' object to str implicitly
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

How do I install python 3.8 onto pytorch environment?

Note that I can only install packages manually

bit_scientist
  • 1,496
  • 2
  • 15
  • 34

1 Answers1

0

Virtualenv requires that you actually have the wanted python version installed.

Depending on what "security wall" means, pip install <> should still work for typical user-wide installation but it will install modules only into your local site-modules (~/.local/lib/python...).

There are multiple ways to run different version of python without installing them system-wide. At the end you could simply download the python binary and run it but that wouldn't be really practical to manage. As alternative you could use something like anaconda or pyenv.

Wereii
  • 330
  • 5
  • 16
  • I cannot install using `pip install <>` because servers are on offline regime, actually I am connecting to the servers using putty through Window OS, even in Windows I cannot install packages using `pip install <>` due to company's security policy. – bit_scientist Jul 31 '20 at 10:52