Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory: 'X/.local/share/pyinstaller' -> 'X/.cache/pyinstaller' #2679

Closed
B4rryD4vis opened this issue Jul 5, 2017 · 0 comments
Assignees

Comments

@B4rryD4vis
Copy link

# LD_LIBRARY_PATH="some_dirs" PYTHONPATH="some_python_dirs" /opensource/.HOST/Python-3.6.1/_install/usr/bin/python -O /opensource/.HOST/PyInstaller-3.3.dev0+5fd013bfe/_install/usr/bin/pyinstaller --onefile --specpath .smx_x86_64/pyi/stuffit --paths "some_python_paths" .smx_x86_64/pyi/stuffit/stuffit.py --strip --name stuffit
51 INFO: PyInstaller: 3.3.dev0+5fd013bfe
51 INFO: Python: 3.6.1
53 INFO: Platform: Linux-2.6.39-i686-with-glibc2.0
53 INFO: wrote .smx_x86_64/pyi/stuffit/stuffit.spec
54 INFO: UPX is not available.
Traceback (most recent call last):
  File "/opensource/.HOST/PyInstaller-3.3.dev0+5fd013bfe/_install/usr/bin/pyinstaller", line 11, in <module>
    load_entry_point('PyInstaller==3.3.dev0+5fd013bfe', 'console_scripts', 'pyinstaller')()
  File "/opensource/.HOST/PyInstaller-3.3.dev0+5fd013bfe/_install/usr/lib/python3.6/site-packages/PyInstaller-3.3.dev0+5fd013bfe-py3.6.egg/PyInstaller/__main__.py", line 87, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/opensource/.HOST/PyInstaller-3.3.dev0+5fd013bfe/_install/usr/lib/python3.6/site-packages/PyInstaller-3.3.dev0+5fd013bfe-py3.6.egg/PyInstaller/__main__.py", line 45, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/opensource/.HOST/PyInstaller-3.3.dev0+5fd013bfe/_install/usr/lib/python3.6/site-packages/PyInstaller-3.3.dev0+5fd013bfe-py3.6.egg/PyInstaller/building/build_main.py", line 778, in main
    CONF.update(configure.get_config(kw.get('upx_dir')))
  File "/opensource/.HOST/PyInstaller-3.3.dev0+5fd013bfe/_install/usr/lib/python3.6/site-packages/PyInstaller-3.3.dev0+5fd013bfe-py3.6.egg/PyInstaller/configure.py", line 99, in get_config
    config['cachedir'] = _get_pyinst_cache_dir()
  File "/opensource/.HOST/PyInstaller-3.3.dev0+5fd013bfe/_install/usr/lib/python3.6/site-packages/PyInstaller-3.3.dev0+5fd013bfe-py3.6.egg/PyInstaller/configure.py", line 82, in _get_pyinst_cache_dir
    os.rename(old_cache_dir, cache_dir)
FileNotFoundError: [Errno 2] No such file or directory: '/development/.local/share/pyinstaller' -> '/development/.cache/pyinstaller'

configure.py

 78         cache_dir = os.path.join(cache_dir, 'pyinstaller')
 79         # Move old cache-dir, if any, to now location
 80         if old_cache_dir and not os.path.exists(cache_dir):
 81             old_cache_dir = os.path.join(old_cache_dir, 'pyinstaller')
 82             if os.path.exists(old_cache_dir):
 83  ->             os.rename(old_cache_dir, cache_dir)
 84         return cache_dir
(Pdb) p old_cache_dir
'/development/.local/share/pyinstaller'
(Pdb) p cache_dir
'/development/.cache/pyinstaller'
root:~# ls /development/.local/share/pyinstaller /development/.cache/pyinstaller -d
ls: /development/.cache/pyinstaller: No such file or directory
/development/.local/share/pyinstaller/
root:~# ls -d /development/.cache
ls: /development/.cache: No such file or directory

So basically, you have a /development/.local/share dir for some reason, probably left over from a failed build. It tries to rename it into the /development/.cache dir, but failed to attempt to make the /development/.cache dir so it blows up

Here's a fix:

--- PyInstaller-3.3.dev0+5fd013bfe/PyInstaller/configure.py     2017-07-05 23:16:08.800856970 +0100
+++ PyInstaller-3.3.dev0+5fd013bfe/PyInstaller/configure.py     2017-07-05 23:17:03.781277532 +0100
@@ -79,6 +79,9 @@
     if old_cache_dir and not os.path.exists(cache_dir):
         old_cache_dir = os.path.join(old_cache_dir, 'pyinstaller')
         if os.path.exists(old_cache_dir):
+            dir = cache_dir.rsplit('/', 1)[0]
+            if not os.path.exists(dir):
+                os.makedirs(dir)
             os.rename(old_cache_dir, cache_dir)
     return cache_dir

@htgoebel htgoebel added pull-request wanted Please submit a pull-request for this, maintainers will not actively work on this. and removed pull-request wanted Please submit a pull-request for this, maintainers will not actively work on this. labels Jul 25, 2017
@htgoebel htgoebel added this to the PyInstaller 3.3 milestone Jul 25, 2017
@htgoebel htgoebel self-assigned this Jul 25, 2017
cowo78 pushed a commit to cowo78/pyinstaller that referenced this issue Dec 7, 2018
Closes pyinstaller#2679. Thanks to mrbazmondo for the fix.

[skip ci] no test-case for this.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants