Reputation: 31
help me, i can't use pyinstaller with matplotlib ,image
File "quanlysinhvien.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "matplotlib\__init__.py", line 890, in <module>
File "matplotlib\__init__.py", line 567, in matplotlib_fname
File "matplotlib\__init__.py", line 564, in gen_candidates
File "matplotlib\__init__.py", line 273, in wrapper
File "matplotlib\__init__.py", line 510, in get_configdir
File "matplotlib\__init__.py", line 465, in _get_config_or_cache_dir
File "pathlib.py", line 1161, in resolve
File "pathlib.py", line 205, in resolve
OSError: [WinError 1] Incorrect function: 'R:\\tmp097e8jcr'
and here is my spec file
block_cipher = None
a = Analysis(
['quanlysinhvien.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=['sklearn.utils._typedefs'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=None,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='quanlysinhvien',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon='quanlysinhvien.ico',
)
i also use sklearn for my application and it doesn't give any error until i add matplotlib, and here is my import I have tried all the methods I know but still no success, please help me
Upvotes: 3
Views: 4504
Reputation: 61
The error [WinError 1] Incorrect function
also happens when you are trying to do os.link
on files that are on an external usb device.
For example, on a Samsung SSD T7 connected via USB 3 which is identified by windows as "Samsung PSSD T7 Shield SCSI Disk Device", formatted as exFat.
The solution in my situation was to manually move the files to an internal drive and then os.link
worked just fine.
Upvotes: 0
Reputation: 955
If your script is on a RAM drive, as Peter asks, move it to a regular one and it may get fixed. Thanks to Peter for mentioning RAM disk!
I just had the same error on Windows with another library (streamlit), which strangely couldn't find the script as if the path was wrong (it was correct). That solution fixed that error.
Now I recalled that RUST also has errors when you try to build on a RAM drive (in order to reduce the writing on an SSD because it produces too much files).
The reason is that it seems some (or the free, e.g. Imdisk, OSFMount) RAM drives on Windows do not implement all standards, POSIX or whatever and they do not support some file functions. I guess there are no such problems on Linux where RAM drives are more "natural" artifacts, but I haven't tried.
Upvotes: 4