Closed rmekdma closed 1 year ago
Hi! Can you show me which command you tried to use so I can reproduce it and add it to the tests?
@macro128 Thanks for your attention.
This is the code I tried.
mamba -c conda-forge
)pdm add --conda pytorch -c pytorch
@rmekdma it seems like a mamba/micromamba with pytorch channel problem.
If you run mamba search -c pytorch pytorch
you get No entries matching "pytorch" found
response, but if you try with conda then it finds pytorch correctly, maybe you should open an issue in https://github.com/mamba-org/mamba.
@macro128 I get different result. I didn't install pdm-conda
.
Hi @rmekdma! Plugin v0.7 and up should work as expected when using mamba/conda runner.
@macro128 Thanks for the work!
The error message changed. Can you check it out?
I installed pdm-conda 0.7.1 by pdm add pdm-conda
It seems that I don't understand how to use pdm/pdm-conda.
pdm add -v --conda retrying
pdm.termui: ======== Start resolving requirements ========
pdm.termui: pdm-conda>=0.7.1
pdm.termui: retrying
pdm.termui: python>=3.11.3,<3.11.4
pdm.termui: Adding requirement pdm-conda>=0.7.1
Lock failed
Unable to find a resolution for pdm-conda
Please make sure the package name is correct.
Traceback (most recent call last):
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/bin/pdm", line 10, in <module>
sys.exit(main())
^^^^^^
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.11/site-packages/pdm/core.py", line 247, in main
return Core().main(args)
^^^^^^^^^^^^^^^^^
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.11/site-packages/pdm/core.py", line 181, in main
raise cast(Exception, err).with_traceback(traceback) from None
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.11/site-packages/pdm/core.py", line 176, in main
f(project, options)
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.11/site-packages/pdm_conda/cli/commands/add.py", line 87, in handle
super().handle(project, options)
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.11/site-packages/pdm/cli/commands/add.py", line 57, in handle
actions.do_add(
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.11/site-packages/pdm/cli/actions.py", line 271, in do_add
resolved = do_lock(project, strategy, tracked_names, reqs, dry_run=dry_run, hooks=hooks)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.11/site-packages/pdm/cli/actions.py", line 115, in do_lock
raise ResolutionImpossible("Unable to find a resolution") from None
resolvelib.resolvers.ResolutionImpossible: Unable to find a resolution
Hi @rmekdma, I'm here to help so don't worry. I suspect some config is missing in pyproject.toml, to check it do this:
pdm self add "pdm-conda>=0.8.0"
(new version with more logs)pdm add -vv --conda retrying
If I'm right you might be missing channel and runner info, adding them in pyproject should be enough, for example:
[tool.pdm.conda]
runner = "mamba"
channels = ["conda-forge"]
I'm sorry. retrying
is in only pypi. I tried again with pytorch
[project]
name = "pdm-test"
version = "0"
requires-python = ">=3.8,<3.11"
[tool.pdm.conda]
runner = "mamba"
channels = ["pytorch", "conda-forge"]
dependencies = ["pytorch>=2", "cpuonly"]
Error log is quite long, so I upload the file. err.txt
You can find that pdm tries to install gpu related packages (cudnn, cudatoolkit, libcblas, nccl) even though I add the cpuonly
dependency.
Maybe this error is from pdm itself?
@rmekdma it was a pdm solver problem with conda requirements, v0.9.0 adds support to conda solver, now pdm-conda
always uses it to solve conda managed requirements so it should give you the exact same resolution.
Thanks! I think its almost there. I encountered an Error but this looks easy.
[project]
name = "pdm-test"
version = "0"
requires-python = ">=3.8,<3.11"
[tool.pdm.conda]
runner = "mamba"
solver = "libmamba"
channels = ["pytorch", "conda-forge"]
dependencies = ["pytorch>=2", "cpuonly"]
Traceback (most recent call last):
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.10/site-packages/pdm/termui.py", line 236, in logging
yield logger
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.10/site-packages/pdm/cli/actions.py", line 94, in do_lock
mapping, dependencies = resolve(
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.10/site-packages/pdm/resolver/core.py", line 35, in resolve
result = resolver.resolve(requirements, max_rounds)
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.10/site-packages/pdm_conda/resolvers.py", line 190, in resolve
resolution.initialize_conda_resolution(requirements)
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.10/site-packages/pdm_conda/resolvers.py", line 178, in initialize_conda_resolution
self._p.repository.update_conda_resolution(list(requirements), self._conda_resolution)
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.10/site-packages/pdm_conda/models/repositories.py", line 103, in update_conda_resolution
resolution = conda_create(
File "/home1/irteam/home/guswns/apps/mambaforge/envs/pdm/lib/python3.10/site-packages/pdm_conda/conda.py", line 317, in conda_create
name = pkg["name"]
TypeError: 'CondaCandidate' object is not subscriptable
Hi @rmekdma, it should be fixed with v0.9.1
Thanks! After I clean the environment I succeeded to pdm install
.
But when I removed pdm.lock
and reran pdm install
, it showed an error.
Seems like the plugin's environment variables were conflicting with conda variables, with v0.9.3 it should be fixed
Thank you! It's working perfectly. I really appreciate you.
conda info
does not support-y
optionI guess this line is the problem. https://github.com/macro128/pdm-conda/blob/3e32dc6c5d9803521608cf4ce83659d28951a480/src/pdm_conda/models/config.py#L165