Python : Auto-py-to exe does not accept the "pathlib" package

294 views Asked by At

I have a script that uses the "pathlib" librairy. In order to make an application, I want to transform my script into an executable.

When I transform my script into an executable via auto-py-to-exe I get this error:

The 'pathlib' package is an obsolete backport of a standard library package and is incompatible with PyInstaller. Please remove this package (located in C:\Users\XXX\anaconda3\Lib\site-packages) using conda remove then try again.

I tried with pyinstaller but I have the same problem. I can't uninstall pathlib, because this library is used in several places in the script.

Thanks in advance for your help

I tried to create an environment on anaconda, but I always get the same error. If I uninstall pathlib, auto-py-to-exe works (but my script doesn't).

1

There are 1 answers

0
DiogoDS On

1 - Remove the pathlib library by writing the command "pip uninstall pathlib" at the prompt

2 - Run auto-py-to-exe normally, without changing anything in the code.

The "Import pathlib" will still work because it is currently already part of the internal python library, so it does not need to be installed. Because of this, installing Pathlib in the latest versions of Python causes conflict when creating the exe.