How to fix ".dist-info directory not found" in my package?

Mason Wheeler picture Mason Wheeler · May 30, 2017 · Viewed 8.8k times · Source

I have a Python 2 package that I'm trying to upgrade to Python 3. It was written by someone who used to work on the same team I'm on now but who is no longer with the company, and unfortunately nobody left on the team is able to help out.

After running 2to3 on the files of the package, I ran python setup.py sdist to create a package, placed the package in a local repository, then attempted to use pip install to install the package. It ended up erroring out with the following:

Exception:
Traceback (most recent call last):
  File "/home/user/project/lib/python3.5/site-packages/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/home/user/project/lib/python3.5/site-packages/pip/commands/install.py", line 297, in run
    root=options.root_path,
  File "/home/user/project/lib/python3.5/site-packages/pip/req/req_set.py", line 622, in install
    **kwargs
  File "/home/user/project/lib/python3.5/site-packages/pip/req/req_install.py", line 808, in install
    self.move_wheel_files(self.source_dir, root=root)
  File "/home/user/project/lib/python3.5/site-packages/pip/req/req_install.py", line 1003, in move_wheel_files
    isolated=self.isolated,
  File "/home/user/project/lib/python3.5/site-packages/pip/wheel.py", line 340, in move_wheel_files
    assert info_dir, "%s .dist-info directory not found" % req
AssertionError: my-package-name .dist-info directory not found

The old Python 2 version of the package didn't have anything called .dist-info in the .tgz archive, and it installed just fine. Does anyone know what's going on here and how to fix it?

Answer

Michael picture Michael · Mar 20, 2019

In my case this was resolved by deleting AppData\Local\pip\Cache folder (windows). Should be fairly similar for other operating systems.