Dots in the python package name seem to break package resolution.
See original GitHub issueThis passes fine:
let
machnix = import (
builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "2.1.0";
}
);
in
machnix.mkPython rec {
requirements = ''
requests==2.24.0
'';
}
While this breaks:
let
machnix = import (
builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix/";
ref = "2.1.0";
}
);
in
machnix.mkPython rec {
requirements = ''
discord.py==1.3.4
'';
}
with this stacktrace:
building '/nix/store/z7cpqqvx49icx1k6fwd50fd60d88c4mq-mach_nix_file.drv'...
Traceback (most recent call last):
File "/nix/store/r06crfb7v84wazad55pysgn6jckv7288-python3-3.7.6-env/lib/python3.7/site-packages/resolvelib/resolvers.py", line 185, in _merge_into_criterion
crit = self.state.criteria[name]
KeyError: 'discord.py'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/nix/store/r06crfb7v84wazad55pysgn6jckv7288-python3-3.7.6-env/lib/python3.7/site-packages/resolvelib/resolvers.py", line 280, in resolve
name, crit = self._merge_into_criterion(r, parent=None)
File "/nix/store/r06crfb7v84wazad55pysgn6jckv7288-python3-3.7.6-env/lib/python3.7/site-packages/resolvelib/resolvers.py", line 187, in _merge_into_criterion
crit = Criterion.from_requirement(self._p, requirement, parent)
File "/nix/store/r06crfb7v84wazad55pysgn6jckv7288-python3-3.7.6-env/lib/python3.7/site-packages/resolvelib/resolvers.py", line 87, in from_requirement
raise RequirementsConflicted(criterion)
resolvelib.resolvers.RequirementsConflicted: Requirements conflict: Requirement.parse('discord.py==1.3.4')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/nix/store/8a5g856g76h0c7kkvw23i7706q451l85-j82lzp1rgj9jfav9zjb1sgk1gfd8gk99-source/mach_nix/generate.py", line 54, in <module>
main()
File "/nix/store/8a5g856g76h0c7kkvw23i7706q451l85-j82lzp1rgj9jfav9zjb1sgk1gfd8gk99-source/mach_nix/generate.py", line 48, in main
expr = generator.generate(reqs)
File "/nix/store/8a5g856g76h0c7kkvw23i7706q451l85-j82lzp1rgj9jfav9zjb1sgk1gfd8gk99-source/mach_nix/generators/overlay_generator.py", line 29, in generate
pkgs = self.resolver.resolve(reqs)
File "/nix/store/8a5g856g76h0c7kkvw23i7706q451l85-j82lzp1rgj9jfav9zjb1sgk1gfd8gk99-source/mach_nix/resolver/resolvelib_resolver.py", line 62, in resolve
result = resolvelib.Resolver(Provider(self.nixpkgs, self.deps_provider), reporter).resolve(reqs, max_rounds=1000)
File "/nix/store/r06crfb7v84wazad55pysgn6jckv7288-python3-3.7.6-env/lib/python3.7/site-packages/resolvelib/resolvers.py", line 413, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "/nix/store/r06crfb7v84wazad55pysgn6jckv7288-python3-3.7.6-env/lib/python3.7/site-packages/resolvelib/resolvers.py", line 282, in resolve
raise ResolutionImpossible(e.criterion.information)
resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=Requirement.parse('discord.py==1.3.4'), parent=None)]
builder for '/nix/store/z7cpqqvx49icx1k6fwd50fd60d88c4mq-mach_nix_file.drv' failed with exit code 1
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Periods get converted to dashes in package name #1576
Yes, the output file above functions correctly, but we're doing extra parsing on it that's breaking because the periods are now dashes. Edit:...
Read more >PEP 423 – Naming conventions and recipes related to ...
This document deals with: names of Python projects,; names of Python packages or modules being distributed,; namespace packages. It provides ...
Read more >How to reference python package when filename contains ...
However, in OP's case, if module name can't be changed, this solution seems like it is reasonable, as it uses well documented interface....
Read more >Python import: Advanced Techniques and Tips
In particular, your top-level module and package names should be unique. ... The problem is that relative imports are resolved differently in scripts...
Read more >Hitchhiker's guide to the Python imports | There is no magic here
module import somesymbol . That funny single dot before module name is read as “current package”. To make a relative import prepend the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for reporting. Maybe a better error message should be printed to inform the user if other versions of that package are available and a hint how to manually upgrade the deps db.
Ahh right, good point. Still new to nix.