Closed goyalyashpal closed 3 months ago
Hi! It seems to be a Windows related problem, as I don't have a Windows machine I can only fix it with your help, if you want to do it please follow these instructions:
pyproject.toml
to match this:
[tool.pdm]
distribution = true
plugins = [
"git+https://github.com/macro128/pdm-conda.git",
]
pdm install --plugins
pdm venv create -vv --cn test -w conda
and show me the output[tool.pdm]
distribution = true
plugins = [
# "pdm-conda",
"git+https://github.com/macro128/pdm-conda.git",
]
> pdm install --plugins
See $LOCALAPPDATA\pdm\pdm\Logs\pdm-install-plugins-h1lvvdp2.log for detailed
debug log.
[UnpackError]: remote: Repository not found.
fatal: repository 'https://github.com/macro128/base/' not found
fatal: clone of 'https://github.com/macro128/base' into submodule path
'$LOCALAPPDATA/Temp/pdm-build-ey1polne/base' failed
Failed to clone 'base'. Retry scheduled
remote: Repository not found.
fatal: repository 'https://github.com/macro128/base/' not found
fatal: clone of 'https://github.com/macro128/base' into submodule path
'$LOCALAPPDATA/Temp/pdm-build-ey1polne/base' failed
Failed to clone 'base' a second time, aborting
WARNING: Add '-v' to see the detailed traceback
Okay, I think your problem is related to how Windows machines use environment variables and I might have fixed it, please try with
[tool.pdm]
distribution = true
plugins = [
"pdm-conda==0.17.5-dev1",
]
> pdm install --plugins
Plugins are installed successfully into .pdm-plugins.
> # pdm venv create -vv --cn test -w conda
> pdm venv create -vv -cn test -w conda
```console
STATUS: Creating virtualenv using conda...
Traceback (most recent call last):
File "
Sorry about that, try with pdm-conda==0.17.5-dev2
i think the wezterm terminal has eaten some of the output for the pdm venv create ...
command
as i think i read there was some "success" or "done", but i might be wrong
anyhow, here's what i got:
> pdm install --plugins
Plugins are installed successfully into .pdm-plugins.
> pdm venv create -vv -cn test -w conda
STATUS: Creating virtualenv using conda...
No channels specified for creating environment, using defaults if exist.
pdm.termui: cmd: conda create -y --strict-channel-priority --json --prefix $LOCALAPPDATA\pdm\pdm\venvs\test python==3.12.* -c defaults --override-channels
> pdm info
[CondaExecutionError]: Error locking dependencies
usage: conda-script.py [-h] [-v] [--no-plugins] [-V] COMMAND ...
conda-script.py: error: unrecognized arguments: -n base
> pdm lock
[CondaExecutionError]: Error locking dependencies
usage: conda-script.py [-h] [-v] [--no-plugins] [-V] COMMAND ...
conda-script.py: error: unrecognized arguments: -n base
WARNING: Add '-v' to see the detailed traceback
> conda env list
# conda environments:
#
$LOCALAPPDATA\pdm\pdm\venvs\test
D:\UserFiles\scoop\apps\mambaforge\24.3.0-0
base D:\UserFiles\scoop\apps\mambaforge\current
```console
> pdm info -v
Traceback (most recent call last):
File "
self note:
see, its cases like this (usage from script/wrappers) in cli applications where on unknown arguments, showing the original invokation command along with usage error might have helped.
but ofc, it would require removing any secrets from there too which would likely increase the hassle of creating such a output message.
just for info, in the conda env list
, the base D:\UserFiles\scoop\apps\mambaforge\current
is a symlink/junction to the D:\UserFiles\scoop\apps\mambaforge\24.3.0-0
. i don't know if it matters or not.
that's due to how scoop
package installer manages stuff.
The good news is pdm venv create
worked correctly so we're getting closer :), I think I patched all the paths correctly and fixed an error with Conda runner parser, please try dm-conda==0.17.5-dev4
.
About the self note: actually it outputs the commands used if you add -vv
flag
now it's back to Not a conda environment
, though the pdm lock
works
test
venv for the pdm list
, rather the one it created on its own.test
venv doesn't show up in pdm venv list
, but it does in conda env list
wezterm again ate somethings now... this time the command i entered.. so, i am just guessing that it was pdm list
in 3rd command below. it also ate some lines when running my own python script too... 😕
```console > pdm install --plugins Plugins are installed successfully into .pdm-plugins. > pdm venv create -vv -cn test -w conda STATUS: Creating virtualenv using conda... [VirtualenvCreateError]: The location $LOCALAPPDATA\pdm\pdm\venvs\test is not empty, add --force to overwrite it. > pdm list WARNING: Project requires a python version of <3.13,>=3.12, The virtualenv is being created for you as it cannot be matched to the right version. INFO: python.use_venv is on, creating a virtualenv for this project... Virtualenv is created successfully at $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12 [CondaExecutionError]: Error locking dependencies EnvironmentLocationNotFound: Not a conda environment: $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12\python.exe WARNING: Add '-v' to see the detailed traceback > pdm venv create -vv -cn test -w conda --force STATUS: Creating virtualenv using conda... pdm.termui: cmd: conda env remove -y --json --prefix $LOCALAPPDATA\pdm\pdm\venvs\test pdm.termui: cmd: conda create -y --strict-channel-priority --json --prefix $LOCALAPPDATA\pdm\pdm\venvs\test python==3.12.* -c defaults --override-channels Virtualenv $LOCALAPPDATA\pdm\pdm\venvs\test is created successfully ``` ```console > pdm info PDM version: 2.15.1 Python Interpreter: $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12\python.exe (3.12) Project Root: D:/... Local Packages: > pdm lock 🔒 Lock successful Changes are written to pdm.lock. ```
```console > pdm list [CondaExecutionError]: Error locking dependencies EnvironmentLocationNotFound: Not a conda environment: $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12\python.exe WARNING: Add '-v' to see the detailed traceback > pdm list -cn test pdm list: error: unrecognized arguments: -cn > pdm list --venv test [PdmUsageError]: No virtualenv with key 'test' is found, must be one of ['3.12']. You can create one with 'pdm venv create'. > pdm venv list Virtualenvs created with this project: - 3.12: $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12 > conda env list # conda environments: # $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12 $LOCALAPPDATA\pdm\pdm\venvs\test D:\UserFiles\scoop\apps\mambaforge\24.3.0-0 base D:\UserFiles\scoop\apps\mambaforge\current ```
```console
> pdm list -vv
Traceback (most recent call last):
File "
Hi! You should use pdm use --venv test
after creating the venv to make pdm run the commands with that python
You should use
pdm use --venv test
hi! like i said, pdm doesn't detect/remember the test
venv as reflected in output of pdm venv list
above. the result of pdm use
aligns with this as shown below.
just for quick reference, i am re-sharing the output of pdm venv list
and conda env list
too
> pdm use --venv test
[PdmUsageError]: No virtualenv with key 'test' is found, must be one of
['3.12'].
You can create one with 'pdm venv create'.
> pdm venv list
Virtualenvs created with this project:
- 3.12: $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12
> conda env list
# conda environments:
#
$LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12
$LOCALAPPDATA\pdm\pdm\venvs\test
D:\UserFiles\scoop\apps\mambaforge\24.3.0-0
base D:\UserFiles\scoop\apps\mambaforge\current
Do the path $LOCALAPPDATA\pdm\pdm\venvs\test
exists with $LOCALAPPDATA
? If it does, there's something weird with environment variables
Do the path
$LOCALAPPDATA\pdm\pdm\venvs\test
exists with$LOCALAPPDATA
?
hi!
$LOCALAPPDATA
verbatim, C:\Users\...\Appdata\Local
. $LO...
before sharing output herethe $
notation is just bleed off of my habbit of using msys2's bash.
Hi! I was just modifying my previous message, I got a Windows machine and fixed all the problems I could find, I tried using scoop and conda/mamba and it worked correctly, if you want to give it a try, use pdm-conda==0.17.5-dev6
this time it errored out at (what seems to be) the very last step i.e. pdm list
, and ran successfully upto pdm use --venv test
```console $ pdm install --plugins Plugins are installed successfully into .pdm-plugins. $ pdm venv create -vv -cn test -w conda --force STATUS: Creating virtualenv using conda... pdm.termui: cmd: conda info --base --json pdm.termui: cmd: conda env remove -y --json --prefix $LOCALAPPDATA\pdm\pdm\venvs\test pdm.termui: cmd: conda create -y --strict-channel-priority --json --prefix $LOCALAPPDATA\pdm\pdm\venvs\test python==3.12.* -c defaults --override-channels Virtualenv $LOCALAPPDATA\pdm\pdm\venvs\test is created successfully $ pdm venv list Virtualenvs created with this project: - 3.12: $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12 - ...proj-3.12: $LOCALAPPDATA\pdm\pdm\venvs\...proj-3.12 - test: $LOCALAPPDATA\pdm\pdm\venvs\test $ pdm use --venv test Using Python interpreter: $LOCALAPPDATA\pdm\pdm\venvs\test\python.exe (3.12) $ pdm lock 🔒 Lock successful Changes are written to pdm.lock. ```
$ pdm list
[CondaExecutionError]: Error locking dependencies
EnvironmentLocationNotFound: Not a conda environment: $LOCALAPPDATA\pdm\pdm\venvs\test\python.exe
WARNING: Add '-v' to see the detailed traceback
$ pdm list -vv
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "$USERPROFILE\.local\bin\pdm.exe\__main__.py", line 7, in <module>
File "D:\UserFiles\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 358, in main
return core.main(args or sys.argv[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\UserFiles\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 276, in main
raise cast(Exception, err).with_traceback(traceback) from None
File "D:\UserFiles\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 271, in main
self.handle(project, options)
File "D:\UserFiles\pipx\venvs\pdm\Lib\site-packages\pdm\core.py", line 207, in handle
command.handle(project, options)
File "D:\UserFiles\pipx\venvs\pdm\Lib\site-packages\pdm\cli\commands\list.py", line 168, in handle
packages = project.environment.get_working_set()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\College\6-Sem\PROJ-CS-302_Project_1\.pdm-plugins\Lib\site-packages\pdm_conda\environments\conda.py", line 85, in get_working_set
dist_map = working_set._dist_map | conda_list(self.project)
^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\College\6-Sem\PROJ-CS-302_Project_1\.pdm-plugins\Lib\site-packages\pdm_conda\conda.py", line 581, in conda_list
packages = run_conda(config.command("list") + ["--json"])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\College\6-Sem\PROJ-CS-302_Project_1\.pdm-plugins\Lib\site-packages\pdm_conda\conda.py", line 152, in run_conda
raise exception_cls(msg, **kwargs) from e
pdm_conda.conda.CondaExecutionError: Error locking dependencies
EnvironmentLocationNotFound: Not a conda environment: $LOCALAPPDATA\pdm\pdm\venvs\test\python.exe
successful yayyy! thanks a lot. 🪔🪔🪔 ur patience is wonderful.
> # This took 3 minutes
> pdm venv create -vv -cn test -w conda --force
STATUS: Creating virtualenv using conda...
pdm.termui: cmd: conda info --base --json
pdm.termui: cmd: conda create -y --strict-channel-priority --json --prefix $LOCALAPPDATA\pdm\pdm\venvs\test python==3.12.* -c defaults --override-channels
Virtualenv $LOCALAPPDATA\pdm\pdm\venvs\test is created successfully
> # Works :)
> pdm venv list
Virtualenvs created with this project:
- test: $LOCALAPPDATA\pdm\pdm\venvs\test
> # This worked by default; `pdm use --venv test` was not required 😀
> pdm list
INFO: Virtualenv $LOCALAPPDATA\pdm\pdm\venvs\test is reused.
╭─────────────────┬─────────────┬──────────╮
│ name │ version │ location │
├─────────────────┼─────────────┼──────────┤
│ bzip2 │ 1.0.8 │ │
│ ca-certificates │ 2024.3.11 │ │
│ expat │ 2.6.2 │ │
│ libffi │ 3.4.4 │ │
...
> pdm lock
🔒 Lock successful
Changes are written to pdm.lock.
> # Works :)
> pdm sync
Synchronizing working set with resolved packages: 36 to add, 0 to update, 0 to
remove
✔ Install certifi 2024.2.2 successful
✔ Install idna 3.7 successful
✔ Install astunparse 1.6.3 successful
...
Installing the project as an editable package...
✔ Install <ProjName> 0.1.0 successful
🎉 All complete!
hi! thanks a lot for this app.
i am having trouble getting started with
pdm-conda
: it is randomly showing errors like:or
and like i have no clue whatsoever on how to how to solve it.
for the conda env not detected, i tried
conda env list
, but the env shown for current project under the$env:LOCALAPPDATA
location doesn't have a name, so i don't know how can that be activated usingconda activate <name>
.it might also be the case that it never really worked under the hood - just that the things i inferred implying that the conda's working fine with pdm was just pdm's task lol
here's how i created the venv:
attachments
environment