Giter Site home page Giter Site logo

Comments (8)

pawamoy avatar pawamoy commented on May 27, 2024

I cannot reproduce the issue in a local environment.

While you install for Python 3.12, pkg_resources is picked up in a Python 3.10 environment: /usr/local/py-utils/shared/lib/python3.10/site-packages/pkg_resources. These are the shared libraries of pipx if I understand correctly. Seems like an environment issue to me 😕 Needs further investigation.

from copier.

aorumbayev avatar aorumbayev commented on May 27, 2024

@pawamoy exactly, its only happening when you are installing a package that has an executable via pipx where pipx itself was initially installed with anything <3.12. Pipx has this mechanism where they chain virtual envs, there is a shared virtual env and a virtual env per each package you install via pipx - the shared venv is created during initial pipx install.

On all default ubuntu github actions workers as well as github codespaces, pipx is preinstalled via 3.10. Hence when you additionally install 3.12 and try to use pipx to install using 3.12 python - it will fail due to that virtual env chaining where it tries to access the 3.10 venv (containing pkg_resources). Why is it doing so in that manner? I have 0 clues.

I will open this on pipx repo as well just in case but i still think the root cause is something to do with the plumbum package that copier is using

from copier.

pawamoy avatar pawamoy commented on May 27, 2024

Thanks for the explanation @aorumbayev! I agree it's confusing and I have 0 clue either how to fix. Maybe removing the shared venv of pipx before installing your project would fix it? That's a hack though. Maybe don't install with pipx? But if your project is an extension for pipx, you definitely want to install with it to test propertly.

The use of pkg_resources in Plumbum indicates code that could be modernized a bit indeed, as nowadays I think the preferred way is to use importlib.resources. Feel free to open an issue on their tracker, linking back to this one 🙂

from copier.

aorumbayev avatar aorumbayev commented on May 27, 2024

@pawamoy thanks, sure will fill the same issue on their repo. Hopefully a quick patch from their side is all it takes

from copier.

henryiii avatar henryiii commented on May 27, 2024

The root issue is the environment is misconfigured; a Python 3.10 site packages is in the path below the 3.12 one; trying to import setuptools gets the 3.10 one.

However, if this is not running localization, it's supposed to take a fast path and avoid this, but it wasn't happening for the "C" locale. Fixing that (out in 1.8.3) should fix this in most cases. And it's technically not a plumbum bug.

I've also got a importlib.metadata version, but I'm not sure we have great testing for localization, so going to wait on that a bit (and likely go 3.8+ soon).

from copier.

pawamoy avatar pawamoy commented on May 27, 2024

Thanks for your help @henryiii!

I've followed along the other opened issues, and can't understand where the Python 3.10 path is coming from either.

I feel like Copier can't do anything here to fix the issue, so I'd vote to close (@copier-org/maintainers). Happy to try and help in the Plumbum/pipx issues if someone tags me there 🙂

from copier.

pawamoy avatar pawamoy commented on May 27, 2024

Definitely looks like an issue with pipx. Seems the shared env is always there in sys.path. I don't know pipx enough to understand why a shared venv is required, but it also doesn't seem to provide an option to disable it.

from copier.

yajo avatar yajo commented on May 27, 2024

Yes, I will close it here because there seems to be nothing Copier can do to fix it 🤷🏼‍♂️

from copier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.