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

TypeError: expected str, bytes or os.PathLike object, not NoneType #4200

Closed
yourback opened this issue Apr 28, 2019 · 7 comments
Closed

TypeError: expected str, bytes or os.PathLike object, not NoneType #4200

yourback opened this issue Apr 28, 2019 · 7 comments
Labels
solution:duplicate Resolved: This issue is a duplicate.

Comments

@yourback
Copy link

there is a error when I pyinstaller exe in venv

`(venv) G:\Py\DataProcessShow>pyinstaller -p G:\Py\venv demo.py
43 INFO: PyInstaller: 3.4
43 INFO: Python: 3.7.3
43 INFO: Platform: Windows-10-10.0.17763-SP0
44 INFO: wrote G:\Py\DataProcessShow\demo.spec
45 INFO: UPX is not available.
46 INFO: Extending PYTHONPATH with paths
['G:\Py\DataProcessShow', 'G:\Py\venv', 'G:\Py\DataProcessShow']
46 INFO: checking Analysis
59 INFO: Building because pathex changed
60 INFO: Initializing module dependency graph...
61 INFO: Initializing module graph hooks...
63 INFO: Analyzing base_library.zip ...
2491 INFO: running Analysis Analysis-00.toc
2493 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by g:\py\venv\scripts\python.exe
2503 INFO: Caching module hooks...
2508 INFO: Analyzing G:\Py\DataProcessShow\demo.py
2572 INFO: Processing pre-find module path hook distutils
3976 INFO: Processing pre-find module path hook site
3976 INFO: site: retargeting to fake-dir 'g:\py\venv\lib\site-packages\PyInstaller\fake-modules'
4855 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
7426 INFO: Processing pre-safe import module hook six.moves
9633 INFO: Loading module hooks...
9634 INFO: Loading module hook "hook-distutils.py"...
9634 INFO: Loading module hook "hook-encodings.py"...
9716 INFO: Loading module hook "hook-lib2to3.py"...
9718 INFO: Loading module hook "hook-matplotlib.backends.py"...
10219 INFO: Matplotlib backend "GTK3Agg": ignored
cairo backend requires that cairocffi or pycairo is installed
10486 INFO: Matplotlib backend "GTK3Cairo": ignored
cairo backend requires that cairocffi or pycairo is installed
10826 INFO: Matplotlib backend "MacOSX": ignored
cannot import name 'macosx' from 'matplotlib.backends' (g:\py\venv\lib\site-packages\matplotlib\backends_init.py)
11093 INFO: Matplotlib backend "nbAgg": ignored
No module named 'IPython'
11472 INFO: Matplotlib backend "Qt4Agg": added
11751 INFO: Matplotlib backend "Qt4Cairo": ignored
cairo backend requires that cairocffi or pycairo is installed
12132 INFO: Matplotlib backend "Qt5Agg": added
12398 INFO: Matplotlib backend "Qt5Cairo": ignored
cairo backend requires that cairocffi or pycairo is installed
12757 INFO: Matplotlib backend "TkAgg": added
13116 INFO: Matplotlib backend "TkCairo": ignored
cairo backend requires that cairocffi or pycairo is installed
13391 INFO: Matplotlib backend "WebAgg": ignored
Traceback (most recent call last):
File "g:\py\venv\lib\site-packages\matplotlib\backends\backend_webagg.py", line 27, in
import tornado
ModuleNotFoundError: No module named 'tornado'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 12, in
File "g:\py\venv\lib\site-packages\matplotlib\backends\backend_webagg.py", line 29, in
raise RuntimeError("The WebAgg backend requires Tornado.")
RuntimeError: The WebAgg backend requires Tornado.
13742 INFO: Matplotlib backend "WX": ignored
No module named 'wx'
14011 INFO: Matplotlib backend "WXAgg": ignored
No module named 'wx'
14285 INFO: Matplotlib backend "WXCairo": ignored
No module named 'wx'
14551 INFO: Matplotlib backend "agg": added
14817 INFO: Matplotlib backend "cairo": ignored
cairo backend requires that cairocffi or pycairo is installed
15157 INFO: Matplotlib backend "pdf": added
15499 INFO: Matplotlib backend "pgf": added
15768 INFO: Matplotlib backend "ps": added
16034 INFO: Matplotlib backend "svg": added
16372 INFO: Matplotlib backend "template": added
16695 INFO: Loading module hook "hook-matplotlib.py"...
16942 INFO: Loading module hook "hook-numpy.core.py"...
17000 INFO: Loading module hook "hook-numpy.py"...
17001 INFO: Loading module hook "hook-pkg_resources.py"...
17431 INFO: Processing pre-safe import module hook win32com
17552 INFO: Loading module hook "hook-pydoc.py"...
17553 INFO: Loading module hook "hook-PyQt5.py"...
17662 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
17727 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
17919 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
18167 INFO: Loading module hook "hook-pythoncom.py"...
18463 INFO: Loading module hook "hook-pywintypes.py"...
18765 INFO: Loading module hook "hook-setuptools.py"...
19394 INFO: Loading module hook "hook-sysconfig.py"...
19395 INFO: Loading module hook "hook-win32com.py"...
19824 INFO: Loading module hook "hook-xml.dom.domreg.py"...
19824 INFO: Loading module hook "hook-xml.py"...
19825 INFO: Loading module hook "hook-tkinter.py"...
19981 INFO: checking Tree
19987 INFO: Building because root changed
19987 INFO: Building Tree Tree-00.toc
20024 INFO: checking Tree
20025 INFO: Building because root changed
20026 INFO: Building Tree Tree-01.toc
20130 INFO: checking Tree
20130 INFO: Building Tree because Tree-02.toc is non existent
20130 INFO: Building Tree Tree-02.toc
20132 INFO: Looking for ctypes DLLs
20168 INFO: Analyzing run-time hooks ...
20174 INFO: Including run-time hook 'pyi_rth_pkgres.py'
20175 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
20176 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
20179 INFO: Including run-time hook 'pyi_rth__tkinter.py'
20180 INFO: Including run-time hook 'pyi_rth_mplconfig.py'
20181 INFO: Including run-time hook 'pyi_rth_mpldata.py'
20182 INFO: Including run-time hook 'pyi_rth_qt5.py'
20193 INFO: Looking for dynamic libraries
21911 INFO: Looking for eggs
21911 INFO: Using Python library F:\software\PY\python37.dll
21912 INFO: Found binding redirects:
[]
21922 INFO: Warnings written to G:\Py\DataProcessShow\build\demo\warn-demo.txt
22055 INFO: Graph cross-reference written to G:\Py\DataProcessShow\build\demo\xref-demo.html
22109 INFO: checking PYZ
22114 INFO: Building because toc changed
22114 INFO: Building PYZ (ZlibArchive) G:\Py\DataProcessShow\build\demo\PYZ-00.pyz
24048 INFO: Building PYZ (ZlibArchive) G:\Py\DataProcessShow\build\demo\PYZ-00.pyz completed successfully.
24066 INFO: checking PKG
24076 INFO: Building because toc changed
24076 INFO: Building PKG (CArchive) PKG-00.pkg
Traceback (most recent call last):
File "F:\software\PY\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "F:\software\PY\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "G:\Py\venv\Scripts\pyinstaller.exe_main
.py", line 9, in
File "g:\py\venv\lib\site-packages\PyInstaller_main
.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "g:\py\venv\lib\site-packages\PyInstaller_main
.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "g:\py\venv\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "g:\py\venv\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
exec(text, spec_namespace)
File "", line 29, in
File "g:\py\venv\lib\site-packages\PyInstaller\building\api.py", line 424, in init
strip_binaries=self.strip, upx_binaries=self.upx,
File "g:\py\venv\lib\site-packages\PyInstaller\building\api.py", line 196, in init
self.postinit()
File "g:\py\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in postinit
self.assemble()
File "g:\py\venv\lib\site-packages\PyInstaller\building\api.py", line 273, in assemble
pylib_name = os.path.basename(bindepend.get_python_library_path())
File "F:\software\PY\lib\ntpath.py", line 218, in basename
return split(p)[1]
File "F:\software\PY\lib\ntpath.py", line 185, in split
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType`

@mentaal
Copy link

mentaal commented May 1, 2019

@yourback
Copy link
Author

yourback commented May 9, 2019 via email

@rwarren
Copy link

rwarren commented Jun 21, 2019

This really needs fixing. Using built-in venv environments with python3.7 is (or should be) extremely popular, so this makes pyinstaller 100% broken right out of the box!

@tsai0009
Copy link

tsai0009 commented Jul 9, 2019

I had this issue too.

What I did was uninstall the original pyinstaller I had, then I cloned from https://github.com/Loran425/pyinstaller.git

Then I also had to navigate to "C:\Users\user\PycharmProjects\myproject\venv\Lib\site-packages\PyInstaller\hooks\hook-jsonschema.py"

and change it to this:

from PyInstaller.utils.hooks import collect_data_files, copy_metadata
datas = collect_data_files('jsonschema')
datas += copy_metadata('jsonschema')

as I was having JSONSchema errors too in Python 3.7.3

@htgoebel htgoebel marked this as a duplicate of #3942 Aug 7, 2019
@htgoebel htgoebel closed this as completed Aug 7, 2019
@htgoebel htgoebel added the solution:duplicate Resolved: This issue is a duplicate. label Aug 7, 2019
@MugumeHenry
Copy link

Am getting the same issue I have tried all the possible solutions but still seeing error

@nesspll
Copy link

nesspll commented Nov 4, 2019

Turn out I forgot to add: __init__.py in a folder I was calling as a package, that solved the issue

@Texnocom
Copy link

Am getting the same issue I have tried all the possible solutions but still seeing error

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
solution:duplicate Resolved: This issue is a duplicate.
Projects
None yet
Development

No branches or pull requests

8 participants