You are not logged in.

#1 2019-03-21 15:02:45

dracofrancis
Member
Registered: 2019-03-03
Posts: 18

[SOLVED] virtualenv too many levels of symbolic links

Hello All,

thank you in advance for helping out! I have downloaded pyenv and then virtualenv on my home directory and I have run the following command in a folder:

virtualenv virtual

Up to this point all good.

I am now trying to run the following command:

$ virtualenv -p python3 virtual

and I get the following error:

Running virtualenv with interpreter /home/takis/.pyenv/shims/python3
Using base prefix '/home/takis/.pyenv/versions/3.5.3'
New python executable in /home/takis/code/ultortrading/virtual/bin/python3
Not overwriting existing python script /home/takis/code/ultortrading/virtual/bin/python (you must use /home/takis/code/ultortrading/virtual/bin/python3)
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/virtualenv.py", line 2567, in <module>
    main()
  File "/usr/lib/python3.7/site-packages/virtualenv.py", line 793, in main
    symlink=options.symlink,
  File "/usr/lib/python3.7/site-packages/virtualenv.py", line 1071, in create_environment
    install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
  File "/usr/lib/python3.7/site-packages/virtualenv.py", line 1620, in install_python
    raise e
  File "/usr/lib/python3.7/site-packages/virtualenv.py", line 1612, in install_python
    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
  File "/home/takis/.pyenv/versions/3.5.3/lib/python3.5/subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "/home/takis/.pyenv/versions/3.5.3/lib/python3.5/subprocess.py", line 1282, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 40] Too many levels of symbolic links

FYI:

$ which python
/home/takis/.pyenv/shims/python
$ which pip
/home/takis/.pyenv/shims/pip

also, these are the contents of my .../virtual/bin/

bin]$ ls -al
total 60
drwxr-xr-x 2 takis users 4096 Mar 21 14:52 .
drwxr-xr-x 5 takis users 4096 Mar 21 14:51 ..
-rw-r--r-- 1 takis users 2113 Mar 21 14:51 activate
-rw-r--r-- 1 takis users 1123 Mar 21 14:51 activate.csh
-rw-r--r-- 1 takis users 3069 Mar 21 14:51 activate.fish
-rw-r--r-- 1 takis users 1540 Mar 21 14:51 activate.ps1
-rw-r--r-- 1 takis users 1512 Mar 21 14:51 activate_this.py
-rw-r--r-- 1 takis users 1013 Mar 21 14:51 activate.xsh
-rwxr-xr-x 1 takis users  265 Mar 21 14:51 easy_install
-rwxr-xr-x 1 takis users  265 Mar 21 14:51 easy_install-3.7
-rwxr-xr-x 1 takis users  247 Mar 21 14:51 pip
-rwxr-xr-x 1 takis users  247 Mar 21 14:51 pip3
-rwxr-xr-x 1 takis users  247 Mar 21 14:51 pip3.7
lrwxrwxrwx 1 takis users    7 Mar 21 14:52 python -> python3
lrwxrwxrwx 1 takis users    6 Mar 21 14:51 python3 -> python
lrwxrwxrwx 1 takis users    7 Mar 21 14:52 python3.5 -> python3
lrwxrwxrwx 1 takis users    6 Mar 21 14:51 python3.7 -> python
-rwxr-xr-x 1 takis users 2355 Mar 21 14:51 python-config
-rwxr-xr-x 1 takis users  243 Mar 21 14:51 wheel

It has happened to me a few times and being a newbie what I do is reinstall arch all over (!!!) because I find no way to solve this.

Any ideas? I really appreciate your help guys smile

Last edited by dracofrancis (2019-03-21 19:46:57)

Offline

#2 2019-03-21 19:37:36

Brocellous
Member
Registered: 2017-11-27
Posts: 162

Re: [SOLVED] virtualenv too many levels of symbolic links

Don't these lines seem suspicious to you?

lrwxrwxrwx 1 takis users    7 Mar 21 14:52 python -> python3
lrwxrwxrwx 1 takis users    6 Mar 21 14:51 python3 -> python

You have 2 symlinks pointing to eachother.

Looks like you ran those 2 commands in sequence and tried to install a different interpreter on top of the existing one.

Normally I think this would fail because the interpreter already exists, but it looks like the first environment was installed by python3.5 managed by pyenv. Why?? Why are you trying to install a virtualenv on top of another virtualenv, _inside_ another virtual environment? This is all wrong. If you just installed python and python-virtualenv with Pacman, all you need to do is run virtualenv one time. If you have python-virtualenv package installed you could have read as much from the virtualenv(1) man page:

       -p PYTHON_EXE, --python=PYTHON_EXE
              The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 interpreter to create the new environment.  The default is the interpreter  that  virtualenv  was  installed  with
              (like /usr/bin/python)

Offline

#3 2019-03-21 19:46:36

dracofrancis
Member
Registered: 2019-03-03
Posts: 18

Re: [SOLVED] virtualenv too many levels of symbolic links

I got your point and I reinstalled it. All good now.

I understand it’s a pretty amateur mistake to do, which reflects exactly my position.

Thank you very much for your time and help!

Offline

#4 2019-03-22 02:24:47

Brocellous
Member
Registered: 2017-11-27
Posts: 162

Re: [SOLVED] virtualenv too many levels of symbolic links

Hey. Sorry for my harsh reply, I didn't mean to take such a harsh tone.

Glad your issue is fixed. I don't want to discourage new users from using the NC for help when they are stuck.

Offline

#5 2019-03-22 03:52:39

nixawk
Member
Registered: 2015-01-23
Posts: 7

Re: [SOLVED] virtualenv too many levels of symbolic links

https://github.com/pypa/pipenv may be another good choice for you.

$ sudo pip install pipenv
$ pipenv shell --python /usr/bin/python
....
(test) $ pipenv install requests
....

Thanks for sharing.

Offline

#6 2019-03-22 07:55:52

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,426

Re: [SOLVED] virtualenv too many levels of symbolic links

nixawk wrote:

https://github.com/pypa/pipenv may be another good choice for you.

$ sudo pip install pipenv
$ pipenv shell --python /usr/bin/python
....
(test) $ pipenv install requests
....

Please don't provide "advice" like this. Doing things like these is exactly how you can easily break your system. You should never sudo pip anything, and especially not packages that are readily available in the repos.

Last edited by V1del (2019-03-22 07:57:40)

Online

Board footer

Powered by FluxBB