Skip to content
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

Installation is broken in nonstandard destination: requirements.txt not found #1

Open
oprypin opened this issue Sep 25, 2022 · 1 comment

Comments

@oprypin
Copy link

oprypin commented Sep 25, 2022

$ pip install -U --no-deps --target mkdocs-pug mkdocs-pug 
Collecting mkdocs-pug
  Using cached mkdocs_pug-0.0.2.tar.gz (3.7 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [10 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-9t3sdcmp/mkdocs-pug_c26e99a678794ab29e9733c49e99d38a/setup.py", line 75, in <module>
          install_requires=parse_requirements(frequirement),
        File "/tmp/pip-install-9t3sdcmp/mkdocs-pug_c26e99a678794ab29e9733c49e99d38a/setup.py", line 17, in parse_requirements
          lineiter = (line.strip() for line in open(filename))
        File "/usr/lib/python3.10/codecs.py", line 905, in open
          file = builtins.open(filename, mode, buffering)
      FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-9t3sdcmp/mkdocs-pug_c26e99a678794ab29e9733c49e99d38a/requirements.txt'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
@oprypin
Copy link
Author

oprypin commented Sep 26, 2022

mkdocs_pug/setup.py

Lines 11 to 18 in 4c67f26

here = path.abspath(path.dirname(__file__))
frequirement = path.join(here, 'requirements.txt')
def parse_requirements(filename):
""" load requirements from a pip requirements file """
lineiter = (line.strip() for line in open(filename))
return [line for line in lineiter if line and not line.startswith("#")]

It should be done like this instead; this code has been working very well for everyone:

https://github.com/squidfunk/mkdocs-material/blob/cccc21431e8e986a6d51aaba6a212db231a5eb09/setup.py#L29-L33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant