question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot install in docker

See original GitHub issue
  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

Use a docker file to install pdm and bring the project to production.

Docker file :

FROM archlinux

# Init package manager keyring
RUN pacman-key --init 
# Update and basic development tools (gcc etc...)
RUN pacman -Syu --noconfirm --quiet  
RUN pacman -S --noconfirm --quiet base-devel  

# Create a project folder
RUN mkdir /python-nlu
WORKDIR /python-nlu

# Copy all project files (including pyproject.toml)
COPY . /python-nlu
RUN mkdir -p models/nlu

# Install the python dependency and python project 
RUN pacman -S --noconfirm --quiet git
RUN pacman -S --noconfirm --quiet python-pip python-setuptools python-wheel 
# Can also run pip install setuptools wheel instead
RUN pip install pdm 
RUN pdm install # Crashes here (or any other pdm related command with the same error)
CMD ["pdm", "run", "server"]

Actual behavior

Getting a

Traceback (most recent call last):
  File "/usr/sbin/pdm", line 5, in <module>
    from pdm.core import main
  File "/usr/lib/python3.9/site-packages/pdm/__init__.py", line 6, in <module>
    from pdm.core import Core
  File "/usr/lib/python3.9/site-packages/pdm/core.py", line 16, in <module>
    from pdm.cli.actions import migrate_pyproject, print_pep582_command
  File "/usr/lib/python3.9/site-packages/pdm/cli/actions.py", line 37, in <module>
    from pdm.resolver import resolve
  File "/usr/lib/python3.9/site-packages/pdm/resolver/__init__.py", line 1, in <module>
    from pdm.resolver.core import resolve  # noqa
  File "/usr/lib/python3.9/site-packages/pdm/resolver/core.py", line 16, in <module>
    _old_merge_into_criterion = Resolution._merge_into_criterion
AttributeError: type object 'Resolution' has no attribute '_merge_into_criterion'

Note that pdm install works locally on my machine (which is also on archlinux).

Expected behavior

Build the image without problems and run pdm in a container

Environment Information

Cannot run pdm info or other pdm related command as it leads to the same error (shown above)

Note that I need the archlinux image as I’m also installing tools (like java, llvm10), etc… so I cannot use the official pdm image.

I suspect that the pip version was updated and pdm isn’t working with the new one maybe something like https://github.com/pypa/pip/issues/9188

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

2reactions
frostmingcommented, Jun 23, 2021

It is because PDM is patching an internal class of resolvelib and is broken by the new release of resolvelib. A bugfix release will soon be out. As a workaround, you can pin the resolvelib version by:

pip install resolvelib==0.7.0 pdm
0reactions
ierezellcommented, Jun 24, 2021

My bad, I copy-pasted the above comment with resolvlib 1.7.0 (I should’ve double-checked). I replaced it with 1.7.1

I did a fresh install by removing __pypackages__ and pdm.lock was it the “fresh” you intended ? I also have them in my .dockerignore so they’re not copied. Also did a docker system prune -a

It works except that I’m stuck in either an infinite dependency resolving loop or get the AttributeError: 'JoinedStr' object has no attribute 's' error from above.

here is my dependency list if you want to try to reproduce (the only constrain is on torch):

"torch==1.8.0", # To make pdm able to install it (latest is 1.9)
"transformers", # need torch
"torchaudio", # need torch
"spacy-transformers", # dependency loop as it need torch 
"uvicorn",
"uvloop",
"faiss-cpu",
"rich",
"fastapi",
"scikit-learn",
"sklearn-crfsuite",
"recognizers-text-suite",
"pytesseract",
"pdf2image",
"scrapy",
"python-multipart",
"language_tool_python",
"symspellpy",
"textdistance",
"epitran",
"bertopic",
"jellyfish",
"claucy @ git+git://github.com/Ierezell/spacy-clausie.git@master",
"parrot @ git+https://github.com/PrithivirajDamodaran/Parrot_Paraphraser.git@main",

Thanks again for your precious time ! Have a great day

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to install docker on windows 10
I am trying to install docker on my window 10 pro but I get the below error. I have 64 bit machine with...
Read more >
Docker Desktop requires Windows 10 Pro or Enterprise ...
I had an issue when installing Docker. Docker Desktop requires Windows 10 Pro or Enterprise version 15063 to run. I have tried to...
Read more >
Windows Server 2016 Standard - cannot install docker
I ran "install-docker-ce.ps1" from powershell (administrator privilege)to install Docker CE on my server. But the Docker Engine Daemon cannot ...
Read more >
How To Install Docker Desktop And Troubleshoot Issues In ...
Type and search Services in the windows search box or open run then type services.msc and click Ok. Then you will see a...
Read more >
How to Install docker in Python? - Finxter
If it doesn't work, try "pip3 install docker" or “ python -m pip install docker “. Wait for the installation to terminate successfully....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found