0

I wrote a code using the pyproj library and converted this code to an exe file for use on another computer. I added the pyproj to the requirements.txt file. And I installed the library with the requirements.txt file on the other computer I will use. When I run the exe file, I get the following error:

importlib.metadata.PackageNotFoundError: No package metadata was found for pyproj

I'd be glad if you can help.

ea23
  • 21
  • 1
  • 1
  • 5
  • Is there a way to tell which python executable installed the code and which one is running the code in the executable? – snowman2 Sep 22 '22 at 12:28
  • I solved the problem when I created the exe file with the command "pyinstaller --onefile --copy-metadata pyproj example.py". Thank you. – ea23 Sep 23 '22 at 08:28

2 Answers2

1

This was caused by a change on pyproj when they updated to version 3.4.0

https://github.com/pyproj4/pyproj/issues/1155

It now requires that the dist-info of the pyproj to be present, so it can find the "version" property inside the METADATA file, so if you have an slim installation (an installation without the dist-info folder) the project will break during the first run of its pyproj/__init__.py.

Another way to fix this problem would be to manually remove that line of the code, (line 70 in the __init__.py) or to hardcode the version of the project there.

Another solution could be to install and leave the metadata with the project, another approach would be to delete everything in the dist-info folder except the METADATA file.

You could however roll back to version 3.3.1 which is prior to that breaking change.

edit: I made a change to pyproj a few days after this message, so this is fixed and no longer happens

Lucas Coppio
  • 328
  • 2
  • 12
0

Here is my solution for those who have problems like above while running the exe file:

 pyinstaller --onefile --copy-metadata pyproj "example.py"

For now this seems to have fixed the problem.

ea23
  • 21
  • 1
  • 1
  • 5