pdm-project / pdm-venv

A plugin for pdm that enables virtualenv management
https://pdm-project.github.io/pdm-venv
MIT License
24 stars 4 forks source link

`pdm plugin add pdm-venv` failure #13

Closed xulongwu4 closed 3 years ago

xulongwu4 commented 3 years ago

Describe the bug On fedora 34 with python 3.9, running pdm plugin add -v pdm-venv results in the following error:

Running pip command: ['install', 'pdm-venv']
Traceback (most recent call last):
  File "/home/oulongwu/.local/lib/python3.9/site-packages/pdm/cli/commands/plugin.py", line 110, in handle
    run_pip(pip_args)
  File "/home/oulongwu/.local/lib/python3.9/site-packages/pdm/cli/commands/plugin.py", line 36, in run_pip
    return subprocess.check_output(
  File "/usr/lib64/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib64/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-I', '/usr/lib/python3.9/site-packages/pip', 'install', 'pdm-venv']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/oulongwu/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/oulongwu/.local/lib/python3.9/site-packages/pdm/core.py", line 194, in main
    return Core().main(args)
  File "/home/oulongwu/.local/lib/python3.9/site-packages/pdm/core.py", line 152, in main
    raise cast(Exception, err).with_traceback(traceback)
  File "/home/oulongwu/.local/lib/python3.9/site-packages/pdm/core.py", line 147, in main
    f(options.project, options)
  File "/home/oulongwu/.local/lib/python3.9/site-packages/pdm/cli/commands/plugin.py", line 112, in handle
    spinner.fail("Installation failed: \n" + e.output)
TypeError: can only concatenate str (not "bytes") to str

To Reproduce Steps to reproduce the behavior:

  1. Install pdm with pip3 install --user pdm
  2. Try installing pdm-venv with pdm plugin add pdm-venv

Expected behavior Install pdm-venv successfully with pdm plugin add pdm-venv.

Screenshots If applicable, add screenshots to help explain your problem.

System (please complete the following information):

Additional context Add any other context about the problem here.

frostming commented 3 years ago

What does it output when running:

/usr/bin/python3 -I /usr/lib/python3.9/site-packages/pip install pdm-venv

I guess it is a permission issue?

try this then:

pdm plugin add --pip-args="--user" pdm-venv
xulongwu4 commented 3 years ago

I had to run /usr/bin/python3 -I /usr/lib/python3.9/site-packages/pip install --user pdm-venv and it finished with no errors:

Collecting pdm-venv
  Using cached pdm_venv-0.2.0-py3-none-any.whl (11 kB)
Collecting pdm>=1.5.0b1
  Using cached pdm-1.7.0-py3-none-any.whl (162 kB)
Collecting virtualenv~=20.4
  Using cached virtualenv-20.6.0-py2.py3-none-any.whl (5.3 MB)
Collecting appdirs
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting click>=7
  Using cached click-8.0.1-py3-none-any.whl (97 kB)
Collecting pdm-pep517<0.9,>=0.8
  Using cached pdm_pep517-0.8.0-py3-none-any.whl (180 kB)
Collecting distlib>=0.3.1
  Using cached distlib-0.3.2-py2.py3-none-any.whl (338 kB)
Collecting shellingham<2.0.0,>=1.3.2
  Using cached shellingham-1.4.0-py2.py3-none-any.whl (9.4 kB)
Collecting resolvelib<0.8.0,>=0.7.0
  Using cached resolvelib-0.7.1-py2.py3-none-any.whl (15 kB)
Collecting pythonfinder
  Using cached pythonfinder-1.2.7-py2.py3-none-any.whl (39 kB)
Requirement already satisfied: pip>=20.1 in /usr/lib/python3.9/site-packages (from pdm>=1.5.0b1->pdm-venv) (21.0.1)
Collecting wheel<1.0.0,>=0.36.2
  Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting atoml>=1.0.3
  Using cached atoml-1.0.3-py3-none-any.whl (29 kB)
Collecting pep517
  Using cached pep517-0.11.0-py2.py3-none-any.whl (19 kB)
Collecting tomli~=1.0
  Using cached tomli-1.1.0-py3-none-any.whl (11 kB)
Collecting python-dotenv~=0.15
  Using cached python_dotenv-0.19.0-py2.py3-none-any.whl (17 kB)
Collecting platformdirs<3,>=2
  Using cached platformdirs-2.1.0-py3-none-any.whl (13 kB)
Collecting backports.entry-points-selectable>=1.0.4
  Using cached backports.entry_points_selectable-1.1.0-py2.py3-none-any.whl (6.2 kB)
Collecting filelock<4,>=3.0.0
  Using cached filelock-3.0.12-py3-none-any.whl (7.6 kB)
Requirement already satisfied: six<2,>=1.9.0 in /usr/lib/python3.9/site-packages (from virtualenv~=20.4->pdm-venv) (1.15.0)
Requirement already satisfied: packaging in /usr/lib/python3.9/site-packages (from pythonfinder->pdm>=1.5.0b1->pdm-venv) (20.9)
Collecting cached-property
  Using cached cached_property-1.5.2-py2.py3-none-any.whl (7.6 kB)
Collecting attrs
  Using cached attrs-21.2.0-py2.py3-none-any.whl (53 kB)
Requirement already satisfied: pyparsing>=2.0.2 in /usr/lib/python3.9/site-packages (from packaging->pythonfinder->pdm>=1.5.0b1->pdm-venv) (2.4.7)
Installing collected packages: tomli, click, cached-property, attrs, wheel, shellingham, resolvelib, pythonfinder, python-dotenv, platformdirs, pep517, pdm-pep517, filelock, distlib, backports.entry-points-selectable, atoml, appdirs, virtualenv, pdm, pdm-venv
Successfully installed appdirs-1.4.4 atoml-1.0.3 attrs-21.2.0 backports.entry-points-selectable-1.1.0 cached-property-1.5.2 click-8.0.1 distlib-0.3.2 filelock-3.0.12 pdm-1.7.0 pdm-pep517-0.8.0 pdm-venv-0.2.0 pep517-0.11.0 platformdirs-2.1.0 python-dotenv-0.19.0 pythonfinder-1.2.7 resolvelib-0.7.1 shellingham-1.4.0 tomli-1.1.0 virtualenv-20.6.0 wheel-0.36.2
frostming commented 3 years ago

So pdm plugin add --pip-args="--user" pdm-venv should also do the trick. The string concatenation is fixed in the main repo. thanks for reporting.