Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pip install issue with egg fragments that lead to an UNKNOWN installation of a package

I have been handed a MacBook Pro and need to ensure that some of our Python 2.7 scripts run on that laptop that run smoothly on Windows machines.

The MacBook is pretty old, 2008, OS X 10.11.6

I am having trouble installing certain packages with pip install on this laptop and am seeking help here as a last resort. First off, Python 2.7.10 is installed and runs smoothly. Pip install works too, but not for all packages. First off, I installed the python-vlc package:

pip install python-vlc --user

Finished without errors. Then I run our script which imports the package using import vlc

python script.py

leads to

Traceback (most recent call last): File "script.py", line 30, in import vlc File "/Users/admin/Library/Python/2.7/lib/python/site-packages/vlc/init.py", line 4, in from vlc.helper import tell File "/Users/admin/Library/Python/2.7/lib/python/site-packages/vlc/helper.py", line 4, in import applescript File "/Users/admin/Library/Python/2.7/lib/python/site-packages/applescript/init.py", line 3, in import only ImportError: No module named only

Seemed like I need to install the package only:

pip install only --user

which lead to

Collecting only Installing collected packages: only Exception: Traceback (most recent call last): File "/Library/Python/2.7/site-packages/pip/_internal/cli/base_command.py", line 143, in main status = self.run(options, args) File "/Library/Python/2.7/site-packages/pip/_internal/commands/install.py", line 366, in run use_user_site=options.use_user_site, File "/Library/Python/2.7/site-packages/pip/_internal/req/init.py", line 49, in install_given_reqs **kwargs File "/Library/Python/2.7/site-packages/pip/_internal/req/req_install.py", line 760, in install use_user_site=use_user_site, pycompile=pycompile, File "/Library/Python/2.7/site-packages/pip/_internal/req/req_install.py", line 382, in move_wheel_files warn_script_location=warn_script_location, File "/Library/Python/2.7/site-packages/pip/_internal/wheel.py", line 326, in move_wheel_files assert info_dir, "%s .dist-info directory not found" % req AssertionError: only .dist-info directory not found

So, tried to manually download it

pip download only

Leads to

Collecting only Running setup.py (path:/private/var/folders/jp/6s5zvb6s0kb19qdgy33sbkf40000gq/T/pip-download-C2CG6U/only/setup.py) egg_info for package only produced metadata for project name unknown. Fix your #egg=only fragments. Successfully downloaded unknown

I'm not quite sure how to address this issue. If I try to go ahead with the installation regardless with

pip install only-1.0.2.tar.gz --user

Processing ./only-1.0.2.tar.gz Building wheels for collected packages: UNKNOWN Running setup.py bdist_wheel for UNKNOWN ... done Stored in directory: /Users/admin/Library/Caches/pip/wheels/13/bb/2c/bbbba0f8e56cc66e91a845dc17f9ba7045e5871aa88062798f Successfully built UNKNOWN Installing collected packages: UNKNOWN Found existing installation: UNKNOWN 0.0.0 Uninstalling UNKNOWN-0.0.0: Successfully uninstalled UNKNOWN-0.0.0 Successfully installed UNKNOWN-0.0.0

Leads to this 'unknown' installation, as it shows up in pip list. Now, googling showed that some had the same issue and they could resolve it by updating setuptools. The setuptools version on this laptop is 1.1.6, so I attempt to update it

pip install setuptools --upgrade --user

Collecting setuptools Using cached https://files.pythonhosted.org/packages/82/a1/ba6fb41367b375f5cb653d1317d8ca263c636cff6566e2da1b0da716069d/setuptools-40.5.0-py2.py3-none-any.whl applescript 0.0.1 requires only, which is not installed. applescript 0.0.1 requires temp, which is not installed. Installing collected packages: setuptools Successfully installed setuptools-40.5.0

It says it successfully installed setuptools 40.5, but it did not as pip list remains unchanged. I'm back at square one because I need to install the package only (and temp), but that leads to an "unknown" installation. Applescript is version 0.0.1. I cannot upgrade it because it attempts to install the package only, which fails.

My guess is that I need to address the egg-info issue when installing only (and temp) package, but I don't know how to. Does anyone have an idea how to resolve this installation issue?

like image 563
Marc Vollenweid Avatar asked Oct 31 '18 06:10

Marc Vollenweid


People also ask

Can you pip install an egg?

Differences From easy_install pip cannot install some packages. Specifically: It cannot install from eggs. It only installs from source.

What is pip install []?

pip is the package installer for Python. It is used to install, update, and uninstall various Python packages (libraries).

Why I cant install packages in Python?

Try to create another Python interpreter that is based on the Python version that meets the requirement. The package cannot be installed because you don't have permissions to install it. Try to install the package using super-user privileges, for example, sudo pip install <package name> .


2 Answers

I ran this

pip install setuptools --upgrade

...and then installed again when I had #egg\UNKNOWN install of a package.

like image 86
SinisterPenguin Avatar answered Sep 28 '22 18:09

SinisterPenguin


I found the workaround. If people have a similar problem, I hope this will help:

I manually wrote a setup.py file according to setuptools specifications.

from setuptools import setup, find_packages

setup(name='only',
      version='1.0.2',
      packages=find_packages(),
     )

Then go into the extracted folder of the downloaded package (in this case after pip download only, into only-1.0.2 directory). Execute

python setup.py install

And you're good to go.

like image 31
Marc Vollenweid Avatar answered Sep 28 '22 19:09

Marc Vollenweid