pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.55k stars 3.04k forks source link

Remove support for installed `.egg` distributions when using the `importlib.metadata` backend #12330

Open sbidoul opened 1 year ago

sbidoul commented 1 year ago

pip has dropped support for installing .egg distributions when it stopped invoking setup.py install. At some point pip will abandon support for detecting and uninstalling legacy .egg distributions too.

If you reach this issue from the pip deprecation message, it is likely that your Python environment has distributions that have been installed with setup.py install, easy_install, or an older pip version.

The recommended action is to uninstall the distribution and reinstall it with a recent pip.

sbidoul commented 1 year ago

@hanivianka have you tried the recommended action mentioned in the top post of this page?

tahayparker commented 12 months ago

@sbidoul has pip 24.3 been released? im tired of seeing the bright message pop up on an otherwise dark screen

sbidoul commented 12 months ago

@tahayparker 24.3 is planned for October 2024.

It is important that affected users resolve the warning by applying the recommendation in the first post of this page.

loong2004 commented 11 months ago

Hello sir, could you please do me a favor? the picture below is the content of my file image I ran "python setup.py install", but after that there is something wrong. You can see it below: image What should I do? I would appreciate it for your kindness. Thank you anyway.

anthobio23 commented 11 months ago

The problem is based on PIP updating. update to 23.3.2, rebuild the build.

first, delete the build and the dist plus the .egg.info folder. rm -rf build dist *.egg.info

build build:

python3 -m pip install --upgrade build
python3 -m build

then, the twine:

python3 -m pip install --upgrade twine
python3 -m twine upload dist/*

view document here: Packaging Python Projects

kinseyy commented 10 months ago

Defaulting to user installation because normal site-packages is not writeable DEPRECATION: Loading egg at c:\program files\python312\lib\site-packages\vboxapi-1.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330

Full error: Defaulting to user installation because normal site-packages is not writeable DEPRECATION: Loading egg at c:\program files\python312\lib\site-packages\vboxapi-1.0-py3.12.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330 Requirement already satisfied: cloudflare in c:\users\aliza\appdata\roaming\python\python312\site-packages (2.16.0)
Requirement already satisfied: requests in c:\users\aliza\appdata\roaming\python\python312\site-packages (from cloudflare) (2.31.0) Requirement already satisfied: pyyaml in c:\users\aliza\appdata\roaming\python\python312\site-packages (from cloudflare) (6.0.1) Requirement already satisfied: jsonlines in c:\users\aliza\appdata\roaming\python\python312\site-packages (from cloudflare) (4.0.0) Requirement already satisfied: attrs>=19.2.0 in c:\users\aliza\appdata\roaming\python\python312\site-packages (from jsonlines->cloudflare) (23.2.0) Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\aliza\appdata\roaming\python\python312\site-packages (from requests->cloudflare) (3.3.2) Requirement already satisfied: idna<4,>=2.5 in c:\users\aliza\appdata\roaming\python\python312\site-packages (from requests->cloudflare) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\aliza\appdata\roaming\python\python312\site-packages (from requests->cloudflare) (2.1.0) Requirement already satisfied: certifi>=2017.4.17 in c:\users\aliza\appdata\roaming\python\python312\site-packages (from requests->cloudflare) (2023.11.17) PS C:\Users\aliza\Desktop\myproject> python .\manage.py runserver Watching for file changes with StatReloader Performing system checks...

Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Program Files\Python312\Lib\threading.py", line 1052, in _bootstrap_inner self.run() File "C:\Program Files\Python312\Lib\threading.py", line 989, in run self._target(*self._args, *self._kwargs) File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\utils\autoreload.py", line 64, in wrapper
fn(
args, **kwargs) File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\core\management\commands\runserver.py", line 133, in inner_run self.check(display_num_errors=True) File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\core\management\base.py", line 485, in check all_issues = checks.run_checks( ^^^^^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\core\checks\registry.py", line 88, in run_checks new_errors = check(app_configs=app_configs, databases=databases) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\core\checks\urls.py", line 14, in check_url_config return check_resolver(resolver) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\core\checks\urls.py", line 24, in check_resolver return check_method() ^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\urls\resolvers.py", line 516, in check
for pattern in self.url_patterns: ^^^^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\utils\functional.py", line 47, in get
res = instance.dict[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\urls\resolvers.py", line 735, in url_patterns patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\utils\functional.py", line 47, in get
res = instance.dict[self.name] = self.func(instance) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\urls\resolvers.py", line 728, in urlconf_module return import_module(self.urlconf_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python312\Lib\importlib__init.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1381, in _gcd_import File "", line 1354, in _find_and_load File "", line 1325, in _find_and_load_unlocked File "", line 929, in _load_unlocked File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "C:\Users\aliza\Desktop\myproject\myproject\urls.py", line 7, in path("auth/", include("authentication.urls")), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\aliza\AppData\Roaming\Python\Python312\site-packages\django\urls\conf.py", line 38, in include urlconf_module = import_module(urlconf_module) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python312\Lib\importlib\init__.py", line 90, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1381, in _gcd_import File "", line 1354, in _find_and_load File "", line 1325, in _find_and_load_unlocked File "", line 929, in _load_unlocked File "", line 994, in exec_module File "", line 488, in _call_with_frames_removed File "C:\Users\aliza\Desktop\myproject\authentication\urls.py", line 3, in from . import views File "C:\Users\aliza\Desktop\myproject\authentication\views.py", line 5, in import cloudflare ModuleNotFoundError: No module named 'cloudflare' PS C:\Users\aliza\Desktop\myproject> ^C

sbidoul commented 10 months ago

@kinseyy the deprecation warning you are facing is due to way vboxapi was installed, and likely unrelated to the error you are facing. Please look at the original post in this issue for a solution.

loong2004 commented 10 months ago

Hi, dude. It's true that I have run the command with "setup.py install" on my Windows terminal. So what should I do next? Could you please show me the instructions in detail? Thank you for your generosity.

jorge-santos commented 10 months ago

egg distributions

Can you give an example how to solve that issue to the people like me that is not so fluent in phytonese, please? :-) Thanks.

pfmoore commented 10 months ago

Can you give an example how to solve that issue to the people like me that is not so fluent in phytonese, please?

Rebuild your environment using the latest version of pip. If you don't know how to rebuild your environment, then I'm assuming that was something that was either done for you, or done as a result of you following a set of instructions that someone provided for you. If that's the case, then you should probably discuss how to rebuild the environment with whoever gave you the environment/instructions.

As an aside, in general I would strongly recommend that anyone who is using pip to install Python packages should learn the basics of what an environment is and how you build and manage one. It's fairly fundamental to how you install packages in Python. There are certainly situations where you can be provided with a Python environment that you should "just use", without needing to know how to manage it, but in that situation I would advise against using pip yourself - you should get packages installed into the environment using tools (or administrative processes) provided by whoever supplies the environment.

rinace43 commented 9 months ago

您好,先生,您能帮我一个忙吗?下图是我运行“python setup.py install”的文件图像内容,但之后出现了问题。你可以在下面看到它:image我该怎么办?感谢您的好意,我将不胜感激。无论如何,谢谢你。

I also want to know what should I do in a similar situation. Who can help me?

pfmoore commented 9 months ago

I also want to know what should I do in a similar situation. Who can help me?

From the original post:

The recommended action is to uninstall the distribution and reinstall it with a recent pip.

rubyFeedback commented 9 months ago

So this is just a short comment; I am struggling right now with the python transition from 3.11.x to python 3.12.x. So many things depend on the python stack these days, and it is suddenly harder to install things from source (for me at the least).

For instance tracker says this:

meson.build:101:26: ERROR: python3 is missing modules: gi

But I installed gi via:

pip install gobject PyGObject

This has worked well in the past, but suddenly the whole python packaging scheme seems to be confused. I get tons of annoying "do this, do that", e. g. "don't use setuptools, use pip, don't use distutils, use that, just use this now, and then that". And it then still does not work.

Have those upstream who decided on this, thought about these downstream issues? Yes you can say this is all the users' fault and it can all be resolved, but why make it harder in the first place? IF the rationale is to make the use of python easier and python in the future, then clear documentation should be used and broadcasted, as well as a transition path documented. Right now I am not sure what that is, since things that used to work no longer work. I am aware this is not solely the fault of python or pip, as meson also plays a role (and it also changed recently ... all that new "meson setup" we suddenly have to use). It's all quite frustrating to have to deal with this ...

RonnyPfannschmidt commented 9 months ago

While I understand the frustration, please keep in mind that the python ecosystem has been working on migration away from fundamentally broken tooling to enable better setup

That's this hits down streams as surprise again and again after years of communicating new standards, warning about the issue simply shows that nobody really cares about the actual progress until their little broken setup is finally affected after practically years of graceful communication

As to why make it seem harder

Same reason why washing hands between obduction and birth help was introduced

liurd commented 9 months ago

What's the best solution for this?

` pip install .\ffmpy-0.3.2.tar.gz Processing c:\project\ffmpy-0.3.2.tar.gz Installing build dependencies ... error error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> [7 lines of output] WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D6DDA09650>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D6DBD24E50>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D6DDA0AD10>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D6DDA0B990>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x000001D6DDA0B350>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/setuptools/ ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none) ERROR: No matching distribution found for setuptools>=40.8.0 [end of output]

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

× pip subprocess to install build dependencies 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.`

pfmoore commented 9 months ago

What's the best solution for this?

  1. This is not related to the issue you posted it to.
  2. As the message says, "This error originates from a subprocess, and is likely not a problem with pip."
  3. The error is a ConnectTimeoutError (a network issue), so you should be looking at your network setup, not at pip, anyway.
Ruin69 commented 8 months ago

IMG_20240314_195124

pfmoore commented 8 months ago

(Please do not post screenshots, copy the text into the issue.)

Did you read the original message in this post? It clearly states:

The recommended action is to uninstall the distribution and reinstall it with a recent pip.

I will also note the warning in the output you show, that you should not be running pip as root, as this can result in breakage. You should be maintaining your system packages with your system package manager, unless you are sure you know what you are doing. Your comment ".I don't know .. how to solve this issue" in #12575 makes it pretty clear you don't have the experience to run pip as root safely, so I would strongly recommend that you use the system package manager instead in this case.

ccoulombe commented 8 months ago

@sbidoul Question, and sorry if I missed this bit of information somewhere, but what is the outcome if one does not reinstall the package with pip ?

Will pip 24.3 ignore that the package X is installed, will an error be raised ?

Thanks,

sbidoul commented 8 months ago

@ccoulombe I don't think this has been determined precisely yet. There is a fair chance that when this happens the environment where .eggs are installed will become difficult to use with pip until the eggs are removed manually.

That is why we are giving ample time to migrate, but at some point people will need stop using setup.py install if they want to continue using modern versions of pip.

ronaldoussoren commented 6 months ago

Hi, I'm the maintainer of py2app and have an issue a user that runs into this change when bundling pip as part of an application packaged with py2app. Py2app bundles the used bits of the standard library and other packages used by the app (in this case including pip) into a zip file in the macOS app bundle.

Do you have any hints on what might trigger the .egg detection for this use case?

The issue on my end: https://github.com/ronaldoussoren/py2app/issues/521

sbidoul commented 6 months ago

@ronaldoussoren it might be you are hitting pkg_resources.find_eggs_in_zip, which seems to look for .egg-info metadata directories. Do you have those in the bundle?

AronicEbilond commented 6 months ago

Alternatively, and this seemed to work for me, I went and uninstalled pip, give or take a few other things I did which may or may not have actually impacted the outcome... such as deleting the .egg files, deleting env's, trying a bunch of cd insert\file\path\here(namely entering the paths so as to delete whats in them as seen here; https://stackoverflow.com/a/60318668) & deleting stuff in appdata(C:\Users\Me\AppData\Local\ActiveState\cache)... But that was me mostly raging & getting nothing done ngl, so uhh, just skip that stuff and jump right to deleting pip.exe located in your main install and then reinstall it with get-pip.py or something. I'm new to this all myself, and I gotta say, this is not one of python's strong points, but damnit, its stronger than other languages so far based on my admittedly minimal level of experience, so take this with a grain of salt - not the solution, but the advice on skipping what I did, cause for all I know, those paths & things could prove helpful in solving, causing, locating, or being the source of that same issue, but caused in different ways.

Aarsh01 commented 5 months ago

show error

 Building wheel for llama-cpp-python (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for llama-cpp-python (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      *** scikit-build-core 0.9.6 using CMake 3.29.6 (wheel)
      *** Configuring CMake...
      2024-06-27 17:26:29,065 - scikit_build_core - WARNING - Can't find a Python library, got libdir=None, ldlibrary=None, multiarch=None, masd=None
      loading initial cache file C:\Users\aarsh\AppData\Local\Temp\tmpcm_ful1v\build\CMakeInit.txt
      -- Building for: NMake Makefiles
      CMake Error at CMakeLists.txt:3 (project):
        Running

         'nmake' '-?'

        failed with:

         no such file or directory

      CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
      CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
      -- Configuring incomplete, errors occurred!

      *** CMake configuration failed
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for llama-cpp-python
Failed to build llama-cpp-python
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (llama-cpp-python)

while installing the llama-cpp-python

ichard26 commented 5 months ago

@Aarsh01 this issue is meant to track deprecated usages of .egg distributions. Your report is not related. You should reach to the developers of llama-cpp-python for help in building the project from source. Alternatively, you can install the pre-built wheel for llama-cpp-python as described in their documentation.

Ankush-Raghuvanshi commented 3 months ago

I used this line of code "!pip install mysql.connector" in the jupiter then notebook then it gives me big error "Defaulting to user installation because normal site-packages is not writeable Collecting mysql.connector Downloading mysql-connector-2.2.9.tar.gz (11.9 MB) ---------------------------------------- 0.0/11.9 MB ? eta -:--:-- ---------------------------------------- 0.0/11.9 MB ? eta -:--:-- --------------------------------------- 0.0/11.9 MB 131.3 kB/s eta 0:01:31 --------------------------------------- 0.0/11.9 MB 131.3 kB/s eta 0:01:31 --------------------------------------- 0.0/11.9 MB 196.9 kB/s eta 0:01:00 --------------------------------------- 0.1/11.9 MB 280.5 kB/s eta 0:00:42 -------------------------------------- 0.2/11.9 MB 811.5 kB/s eta 0:00:15

Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: vboxapi in c:\programdata\anaconda3\lib\site-packages\vboxapi-1.0-py3.11.egg (1.0) Note: you may need to restart the kernel to use updated packages. DEPRECATION: Loading egg at c:\programdata\anaconda3\lib\site-packages\vboxapi-1.0-py3.11.egg is deprecated. pip 24.3 will enforce this behaviour change. A possible replacement is to use pip for package installation.. Discussion can be found at https://github.com/pypa/pip/issues/12330". How i solve this error?

notatallshaw commented 3 months ago

How i solve this error?

You're installing the wrong package: https://pypi.org/project/mysql-connector/.

You should be using: https://pypi.org/project/mysql-connector-python/

As there is very limited support capacity here if you are having problem installing a package, you should:

  1. Check the PyPI page or home page of the package for installation instructions
  2. Ask peers or search/post in help forums, such as Python Discuss help category, /r/learnpython on reddit, Python Discord's #python-help channel, #python on Libera.chat (IRC), python-list or python-tutor mailing lists, or StackOverflow
  3. File a bug with the package author
jiapei100 commented 2 months ago

The problem is based on PIP updating. update to 23.3.2, rebuild the build.

first, delete the build and the dist plus the .egg.info folder. rm -rf build dist *.egg.info

build build:

python3 -m pip install --upgrade build
python3 -m build

then, the twine:

python3 -m pip install --upgrade twine
python3 -m twine upload dist/*

view document here: Packaging Python Projects

What if pip is NOT installed from source? But just upgraded directly by pip install -U pip ?

PauloBoaventura commented 2 months ago

any solution found? is it possible to use a previous version? so that it works... How can an update be inserted which compromises the development...

pfmoore commented 2 months ago

@PauloBoaventura From the original post:

The recommended action is to uninstall the distribution and reinstall it with a recent pip.