pythonpipsetuptoolspkg-resources

`pkg_resources.working_set` contains distributions whose name begins with character "-"


On my installation (Python 3.8.1 on Windows 7), if I run the following code:

import pkg_resources
print([d.key for d in pkg_resources.working_set if d.key[0] == "-"])

I get the following output:

['-fi', '-', '-.fi', '-ffi']

What are these packages beginning with "-"?

I add that on my system, every time I upgrade the package "cffi" with command pip install --upgrade cffi, I get the following error (which after some research online I guess is due to the antivirus, which I cannot disable):

ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Accesso negato: 'C:\\Users\\myuser\\AppData\\Local\\Temp\\pip-uninstall-pai0_5kc\\_cffi_backend.cp38-win_amd64.pyd'
Consider using the `--user` option or check the permissions.

but anyway the upgrade is successful (I can confirm it with pip show cffi).

Could those packages resulting from this? Should I get rid of them and how?


Solution

  • Could those packages resulting from this?

    No. Error "Access denied" means you don't have enough privileges to write to a system directory.

    Run pip install as Administrator. Better: run pip install --user. The best: use a virtual environment.

    Should I get rid of them

    Not strictly necessary but you better get rid.

    how?

    By removing their subdirectories from site-packages directory.