5

I am using macOS, and Anaconda 3 in order to manage my libraries and write the script.

I want to create an executable for my script.

I am using Pyinstaller in Terminal to run the command:

pyinstaller --onefile /Directory/file.py

However, Terminal returns this error:

File "/anaconda3/lib/python3.6/site-packages/PyInstaller/hooks/hook-sysconfig.py", line 42, in <module> hiddenimports = [sysconfig._get_sysconfigdata_name()] TypeError: _get_sysconfigdata_name() missing 1 required positional argument: 'check_exists'

How can I solve this problem; thank you for your assistance.

2 Answers 2

4

conda update conda did not work for me, so I will just post my solution here.

First, go to python interactive shell, do

$ python
>> import sysconfig
>> print(sysconfig.__file__)

This should give you where the file locates for sysconfig. Then what you need to go to that file and edit the source code, for me it was /opt/conda/envs/test/lib/python3.6/sysconfig.py, then find the function and change function signature for _get_sysconfigdata_name, what I did was make check_exists default to True.

Sign up to request clarification or add additional context in comments.

1 Comment

In my case, I was not able to modify the sysconfig.py because it was in root folder, so I modified hiddenimports = [sysconfig._get_sysconfigdata_name()] to hiddenimports = [sysconfig._get_sysconfigdata_name(check_exists=True)] in venvs\test\lib\site-packages\Pyinstaller\hooks\hook- distutils.py instead
3

This is a known issue in older versions of Anaconda. You can try to update Anaconda (in the conda terminal):

conda update conda

You can also try to remove the sysconfig._get_sysconfigdata_name() from the hiddenimports list in your .spec file and instead add import sysconfig in your .py file.

The following issue documentation on the pyinstaller github page may be of further help: https://github.com/pyinstaller/pyinstaller/issues/3192

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.