lukesmurray / markdown-anki-decks

Tool for converting markdown files into anki decks
MIT License
130 stars 12 forks source link

Can't install dependencies with the current poetry.lock file #7

Closed ZBQtesla closed 2 years ago

ZBQtesla commented 2 years ago

Hello @lukesmurray, thank you for developing and maintaining this nice tool! I have used it for a few months, and it just worked very fine.

I want to contribute to this project. But when I installed the dependencies, I faced a problem:

Problem description

I installed the latest nightly version (1.2.0b1) of poetry followed the instructions of poetry's official document (i.e. curl -sSL https://install.python-poetry.org | python3 - --preview).

Then I cd into this project's root directory, and run poetry install. But the installation process failed with this error messages (the whole output is too long, so I omitted some normal output indicated with ......):

Installing dependencies from lock file
Warning: poetry.lock is not consistent with pyproject.toml. You may be getting improper dependencies. Run `poetry lock [--no-update]` to fix it.

Package operations: 54 installs, 0 updates, 0 removals

......

  • Installing pystache (0.5.4)

......

  CalledProcessError

  Command '['/home/zhang/.cache/pypoetry/virtualenvs/markdown-anki-decks-rze0aDXw-py3.8/bin/python', '/home/zhang/.local/share/pypoetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl/pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/zhang/.cache/pypoetry/virtualenvs/markdown-anki-decks-rze0aDXw-py3.8', '--no-deps', '/home/zhang/.cache/pypoetry/artifacts/1b/1e/f2/9624a38b93966b51c608128cbd854070cdd2344337147b9a5df7e8447b/pystache-0.5.4.tar.gz']' returned non-zero exit status 1.

  at /usr/lib/python3.8/subprocess.py:516 in run
       512│             # We don't call process.wait() as .__exit__ does that for us.
       513│             raise
       514│         retcode = process.poll()
       515│         if check and retcode:
    →  516│             raise CalledProcessError(retcode, process.args,
       517│                                      output=stdout, stderr=stderr)
       518│     return CompletedProcess(process.args, retcode, stdout, stderr)
       519│ 
       520│ 

The following error occurred when trying to handle this error:

  EnvCommandError

  Command ['/home/zhang/.cache/pypoetry/virtualenvs/markdown-anki-decks-rze0aDXw-py3.8/bin/python', '/home/zhang/.local/share/pypoetry/venv/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-22.0.4-py3-none-any.whl/pip', 'install', '--use-pep517', '--disable-pip-version-check', '--prefix', '/home/zhang/.cache/pypoetry/virtualenvs/markdown-anki-decks-rze0aDXw-py3.8', '--no-deps', '/home/zhang/.cache/pypoetry/artifacts/1b/1e/f2/9624a38b93966b51c608128cbd854070cdd2344337147b9a5df7e8447b/pystache-0.5.4.tar.gz'] errored with the following return code 1, and output: 
  Processing /home/zhang/.cache/pypoetry/artifacts/1b/1e/f2/9624a38b93966b51c608128cbd854070cdd2344337147b9a5df7e8447b/pystache-0.5.4.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'error'
    error: subprocess-exited-with-error

    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [3 lines of output]
        pystache: using: version '60.10.0' of <module 'setuptools' from '/tmp/pip-build-env-at964syv/overlay/lib/python3.8/site-packages/setuptools/__init__.py'>
        Warning: 'classifiers' should be a list, got type 'tuple'
        error in pystache setup command: use_2to3 is invalid.
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.

  at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/env.py:1421 in _run
      1417│                 output = subprocess.check_output(
      1418│                     cmd, stderr=subprocess.STDOUT, env=env, **kwargs
      1419│                 )
      1420│         except CalledProcessError as e:
    → 1421│             raise EnvCommandError(e, input=input_)
      1422│ 
      1423│         return decode(output)
      1424│ 
      1425│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int | None:

The following error occurred when trying to handle this error:

  PoetryException

  Failed to install /home/zhang/.cache/pypoetry/artifacts/1b/1e/f2/9624a38b93966b51c608128cbd854070cdd2344337147b9a5df7e8447b/pystache-0.5.4.tar.gz

  at ~/.local/share/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/pip.py:55 in pip_install
       51│ 
       52│     try:
       53│         return environment.run_pip(*args)
       54│     except EnvCommandError as e:
    →  55│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       56│ 

Connection pool is full, discarding connection: files.pythonhosted.org. Connection pool size: 10

......

I even did a couple of other attempts:

  1. uninstall the poetry latest nightly version(1.2.0b1), but use the latest stable version(1.1.13) instead
  2. install in another computer which has a separate environment

But they all failed with similar error about "pystache" package

And with poetry nightly version, the output message suggested that "poetry.lock is not consistent with pyproject.toml.":

Snipaste_2022-03-21_17-01-48

so then I tried to update the poetry.lock file with poetry update --lock. After that, I ran poetry install, now it successed!

So, can you please update the poetry.lock file or may I open a PR to update this file if this problem was really caused by the outdated lock file? And maybe it was caused by some problems with my configurations, if this is the case, please let me know, thank you very much!

How to reproduce the issue

  1. install the latest nightly version(1.2.0b1) or latest stable version(1.1.13) of poetry
  2. remove the previous virtual environment of this project managed by poetry with poetry env remove ENV_NAME
  3. run poetry install

Possible solution

  1. poetry update --lock as metioned in poetry official document: here and here
  2. push with the updated lock file

My environment information

Name Value
Operating system WSL2(Ubuntu 20.04)
Python version 3.8.10
Poetry version 1.2.0b1
lukesmurray commented 2 years ago

thanks for the bug report! i'll try to get this sorted as soon as possible. awesome that you want to contribute!

lukesmurray commented 2 years ago

@ZBQtesla I pushed a fix for this to luke/poetry-fix. If you have time could you try cloning that branch and let me know if poetry install work for you?

ZBQtesla commented 2 years ago

@lukesmurray It worked for me!

Snipaste_2022-03-22_09-15-04 ...... Snipaste_2022-03-22_09-16-07

I also tested with poetry run mdankideck testData/input testData/output --prefix "devtest::" --sync and it worked too.

Thank you so much!

lukesmurray commented 2 years ago

sweet @ZBQtesla ! thanks for your help and looking forward to any contributions. Feel free to open an issue to discuss any potential features or changes you have in mind.