-
-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to install with version annotation and wheel? (e.g. pytorch cpu version) #694
Comments
pdm currently doesn't support find link pages with |
@frostming Thanks! And my team members use different operating systems. Can pdm cover this case declaratively? Should I workaround it by |
I think you may need #696 which just landed in the main branch. Just that |
@frostming Oh, great! |
yes, but would you like to help testing if possible? |
@frostming Sure, how? |
install the dev version and test if it works should be easy to do with |
@frostming I tried something like an above example, but failed. |
use == please |
@frostming dependencies = [
"torch==1.10.0+cpu",
] But an error occurs. root@ccd295b0870b:/experiment# pdm install
Traceback (most recent call last):
File "/usr/local/bin/pdm", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/pdm/core.py", line 200, in main
return Core().main(args)
File "/usr/local/lib/python3.9/site-packages/pdm/core.py", line 138, in main
self.ensure_project(options, obj)
File "/usr/local/lib/python3.9/site-packages/pdm/core.py", line 108, in ensure_project
migrate_pyproject(options.project)
File "/usr/local/lib/python3.9/site-packages/pdm/cli/actions.py", line 677, in migrate_pyproject
if project.pyproject and "project" in project.pyproject:
File "/usr/local/lib/python3.9/site-packages/pdm/project/core.py", line 99, in pyproject
data = atoml.parse(self.pyproject_file.read_text("utf-8"))
File "/usr/local/lib/python3.9/site-packages/atoml/api.py", line 68, in parse
return Parser(string).parse()
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 152, in parse
key, value = self._parse_table()
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 1159, in _parse_table
key_next, table_next = self._parse_table(name, table)
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 1146, in _parse_table
item = self._parse_item()
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 298, in _parse_item
return self._parse_key_value(True)
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 389, in _parse_key_value
val = self._parse_value()
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 561, in _parse_value
return self._parse_array()
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 710, in _parse_array
elems.append(self._parse_value())
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 563, in _parse_value
return self._parse_inline_table()
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 773, in _parse_inline_table
key, val = self._parse_key_value(False)
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 370, in _parse_key_value
key = self._parse_key()
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 414, in _parse_key
return self._parse_bare_key()
File "/usr/local/lib/python3.9/site-packages/atoml/parser.py", line 466, in _parse_bare_key
raise self.parse_error(ParseError, "Empty key found")
atoml.exceptions.ParseError: Empty key found at line 25 col 3 I still doubt if this is right setting. |
It is TOML, not JSON: [[tool.pdm.source]]
type = "find_links"
url = "..."
name = "torch" |
@frostming Hmm still having an error. pyproject.toml [project]
name = ""
version = ""
description = ""
authors = [
{name = "", email = ""},
]
dependencies = [
"torch==1.10.0+cpu",
]
requires-python = ">=3.9"
dynamic = ["classifiers"]
license = {text = "MIT"}
[project.urls]
homepage = ""
[build-system]
requires = ["pdm-pep517"]
build-backend = "pdm.pep517.api"
[[tool.pdm.source]]
type = "find_links"
url = "https://download.pytorch.org/whl/cpu/torch_stable.html"
name = "torch" installation root@ccd295b0870b:/experiment# pdm install -v
Lock file does not exist or is incompatible, trying to generate one...
======== Start resolving requirements ========
torch==1.10.0+cpu
python>=3.9
Adding requirement torch==1.10.0+cpu
Could not find any matching candidates.
Could not find any matching candidates even when considering pre-releases.
Found but non-matching candidates:
<Candidate torch 1.10.0 from https://pypi.org/simple/torch/>
<Candidate torch 1.9.1 from https://pypi.org/simple/torch/>
<Candidate torch 1.9.0 from https://pypi.org/simple/torch/>
<Candidate torch 1.8.1 from https://pypi.org/simple/torch/>
<Candidate torch 1.8.0 from https://pypi.org/simple/torch/>
<Candidate torch 1.7.1 from https://pypi.org/simple/torch/>
<Candidate torch 1.7.0 from https://pypi.org/simple/torch/>
<Candidate torch 1.6.0 from https://pypi.org/simple/torch/>
<Candidate torch 1.5.1 from https://pypi.org/simple/torch/>
<Candidate torch 1.5.0 from https://pypi.org/simple/torch/>
... [224 more candidate(s)]
🔒 Lock failed
Unable to find a resolution that satisfies the following requirements:
torch==1.10.0+cpu (from project)
Please make sure the package names are correct. If so, you can either loosen the version constraints of these dependencies, or set a narrower `requires-python` range in the pyproject.toml.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 341, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 173, in _add_to_criteria
raise RequirementsConflicted(criterion)
resolvelib.resolvers.RequirementsConflicted: Requirements conflict: NamedRequirement(name='torch', marker=None, extras=(), specifier=<SpecifierSet('==1.10.0+cpu')>, editable=False)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/pdm", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/pdm/core.py", line 200, in main
return Core().main(args)
File "/usr/local/lib/python3.9/site-packages/pdm/core.py", line 153, in main
raise cast(Exception, err).with_traceback(traceback)
File "/usr/local/lib/python3.9/site-packages/pdm/core.py", line 148, in main
f(options.project, options)
File "/usr/local/lib/python3.9/site-packages/pdm/cli/commands/install.py", line 38, in handle
actions.do_lock(project, strategy="all")
File "/usr/local/lib/python3.9/site-packages/pdm/cli/actions.py", line 68, in do_lock
mapping, dependencies = resolve(
File "/usr/local/lib/python3.9/site-packages/pdm/resolver/core.py", line 31, in resolve
result = resolver.resolve(requirements, max_rounds)
File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 472, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/usr/local/lib/python3.9/site-packages/resolvelib/resolvers.py", line 343, in resolve
raise ResolutionImpossible(e.criterion.information)
resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=NamedRequirement(name='torch', marker=None, extras=(), specifier=<SpecifierSet('==1.10.0+cpu')>, editable=False), parent=None)] info root@ccd295b0870b:/experiment# pdm info
PDM version: 1.9.1.dev13+gf252992
Python Interpreter: /usr/local/bin/python (3.9)
Project Root: /experiment
Project Packages: /experiment/__pypackages__/3.9 |
Oh, I've updated the main branch, would you try again? |
@frostming I tried! So there's only one issue left.
Even if we decide to always use cpu-only version no matter if the environment is for development or production, pytorch should be installed differently by platform. Currently I am thinking using concepts of pyproject.yaml [project.optional-dependencies]
cpu = [
"torch==1.10.0+cpu",
]
gpu = [
"torch==1.10.0"
] But in this way, we should execute the command differently (not just simply Would it be the best solution? |
(Thanks! It was great to know find_links become available from the next version!) |
I am using I am trying
Without the |
the following seems to have done the trick
my pdm.lock looks like this:
|
You are making a mistake: you thought >= works similarly to == and should work when combined with 2.0.0+cpu. However this is wrong, +cpu local version can't be used with comparison operators but can be used with equality and inequality operators. |
Thanks, works like a charm! |
Pytorch's official page guides user to install the cpu-only mode of package by the following.
If I run
then an error occurs.
If I run
then another error occurs.
How can I do?
Thanks.
Environment Information
The text was updated successfully, but these errors were encountered: