Can anyone have a look what goes wrong with my pyinstaller?
I also tried to convert a .py file to .exe file, but the same error was generated
Update. 12/15. BTW, I have installed both python 2.7 and python 3 on my computer, would that be the problem?
However, I have tried install pyinstaller under C:\Python27\Scripts to try to avoid the conflict between 2 pythons. (I am not sure if this could still cause the problem but I just try to list all the details I know for the question.)
New update. 12/16. I have tried to move my target file (to convert) to the script folder, where pyinstaller is installed, the file will be converted successfully. But the script folder will be messed up because multiple folders and files will be generated.
I have added the problem that generated from cmd below :)
C:\Python27\Scripts>pip install pyinstaller
Collecting pyinstaller
Requirement already satisfied: pefile>=2017.8.1 in c:\python27\lib\site-packages (from pyinstaller) (2018.8.8)
Requirement already satisfied: pywin32-ctypes in c:\python27\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: setuptools in c:\python27\lib\site-packages (from pyinstaller) (28.8.0)
Requirement already satisfied: altgraph in c:\python27\lib\site-packages (from pyinstaller) (0.16.1)
Requirement already satisfied: macholib>=1.8 in c:\python27\lib\site-packages (from pyinstaller) (1.11)
Requirement already satisfied: dis3 in c:\python27\lib\site-packages (from pyinstaller) (0.1.2)
Requirement already satisfied: future in c:\python27\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.17.1)
Installing collected packages: pyinstaller
Successfully installed pyinstaller-3.4
C:\Python27\Scripts>pyinstaller
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pyinstaller.exe\__main__.py", line 5, in <module>
File "c:\python27\lib\site-packages\PyInstaller\__init__.py", line 16, in <module>
from . import compat
File "c:\python27\lib\site-packages\PyInstaller\compat.py", line 212, in <module>
from win32ctypes.pywin32 import pywintypes # noqa: F401
File "c:\python27\lib\site-packages\win32ctypes\pywin32\__init__.py", line 11, in <module>
from win32ctypes.pywin32 import win32api
File "c:\python27\lib\site-packages\win32ctypes\pywin32\win32api.py", line 12, in <module>
from win32ctypes.core import (
File "c:\python27\lib\site-packages\win32ctypes\core\__init__.py", line 36, in load_module
module = importlib.import_module(self.redirect_module)
File "c:\python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "c:\python27\lib\site-packages\win32ctypes\core\cffi\_dll.py", line 19, in <module>
""")
File "c:\python27\lib\site-packages\cffi\api.py", line 107, in cdef
self._parser.parse(csource, override=override, packed=packed)
File "c:\python27\lib\site-packages\cffi\cparser.py", line 167, in parse
self._internal_parse(csource)
File "c:\python27\lib\site-packages\cffi\cparser.py", line 173, in _internal_parse
ast, macros, csource = self._parse(csource)
File "c:\python27\lib\site-packages\cffi\cparser.py", line 130, in _parse
self.convert_pycparser_error(e, csource)
File "c:\python27\lib\site-packages\cffi\cparser.py", line 159, in convert_pycparser_error
raise api.CDefError(msg)
cffi.api.CDefError: cannot parse "HMODULE WINAPI LoadLibraryExW(LPCTSTR lpFileName, HANDLE hFile, DWORD dwFlags);"
:16:16: before: LoadLibraryExW
Try to upgrade the cffi by using below command:
pip install --upgrade cffi
Related
I'm trying to install aiohttp on a Python 3.7 virtualenv. It's failing with an odd AttributeError when trying to install the yarl dependency.
$ pip install aiohttp
Collecting aiohttp
Using cached https://files.pythonhosted.org/packages/33/60/c21acb7002110699761d3dec36fad3f5087c2752a4eb495444f877db6
553/aiohttp-3.5.4-cp37-cp37m-manylinux1_x86_64.whl
Collecting multidict<5.0,>=4.0 (from aiohttp)
Downloading https://files.pythonhosted.org/packages/88/f0/4d4cbd1a3744e3985efa49682352d0703df653ffa76b81f10fed86599a
50/multidict-4.5.2-cp37-cp37m-manylinux1_x86_64.whl (309kB)
100% |████████████████████████████████| 317kB 65.0MB/s
Collecting attrs>=17.3.0 (from aiohttp)
Using cached https://files.pythonhosted.org/packages/3a/e1/5f9023cc983f1a628a8c2fd051ad19e76ff7b142a0faf329336f9a62a
514/attrs-18.2.0-py2.py3-none-any.whl
Requirement already satisfied: async-timeout<4.0,>=3.0 in /fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site
-packages (from aiohttp) (3.0.1)
Requirement already satisfied: chardet<4.0,>=2.0 in /fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site-packa
ges (from aiohttp) (3.0.4)
Collecting yarl<2.0,>=1.0 (from aiohttp)
Downloading https://files.pythonhosted.org/packages/fb/84/6d82f6be218c50b547aa29d0315e430cf8a23c52064c92d0a8377d7b7357/yarl-1.3.0.tar.gz (159kB)
100% |████████████████████████████████| 163kB 87.1MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-od3qiiy3/yarl/setup.py", line 102, in <module>
setup(**args)
File "/fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site-packages/setuptools/__init__.py", line 142, i
n setup
_install_setup_requires(attrs)
File "/fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site-packages/setuptools/__init__.py", line 131, i
n _install_setup_requires
(k, v) for k, v in attrs.items()
File "/fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site-packages/setuptools/dist.py", line 442, in __
init__
k: v for k, v in attrs.items()
File "/usr/lib/python3.7/distutils/dist.py", line 292, in __init__
self.finalize_options()
File "/fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site-packages/setuptools/dist.py", line 600, in fi
nalize_options
ep.require(installer=self.fetch_build_egg)
File "/fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site-packages/pkg_resources/__init__.py", line 236
7, in require
reqs = self.dist.requires(self.extras)
File "/fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site-packages/pkg_resources/__init__.py", line 263
5, in requires
dm = self._dep_map
File "/fast/src/mobitroll/merlin/tools/ws/.py37/lib/python3.7/site-packages/pkg_resources/__init__.py", line 269
1, in __getattr__
raise AttributeError(attr)
AttributeError: _dep_map
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-od3qiiy3/yarl/
I tried to look for documented issues in github for aiohttp and yarl but found nothing of sorts.
Also tried to install slightly older versions of yarl (1.0, 1.1, 1.2) but without much luck either.
Any idea what could be the cause of this error?
Upgrading setuptools with pip install -U setuptools fixed the issue.
I am currently trying to install kivy to python 3.6, but when i am trying yo install it it throws the following exception:
C:\Users\magshimim\Desktop\notKivy>python -m pip install kivy
Collecting kivy
Using cached
https://files.pythonhosted.org/packages/29/e6/e07f77a8d85a626bb955fe072d41042c4c
ee6deaca61295f1c08e6407097/Kivy-1.10.0-cp36-cp36m-win32.whl Collecting Kivy-Garden>=0.1.4 (from kivy)
Using cached https://files.pythonhosted.org/packages/7d/68/decaee596ff8168a39432eb3949fc7c0be952ebb9467806823bffc165d48/kivy-garden-0.1.4.tar.gz
Requirement already satisfied: docutils in c:\python36\lib\site-packages (from kivy)
Requirement already satisfied: pygments in c:\python36\lib\site-packages (from kivy)
Requirement already satisfied: requests in c:\python36\lib\site-packages (from Kivy-Garden>=0.1.4->kivy)
Exception:
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Python36\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Python36\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Python36\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Python36\lib\site-packages\pip\req\req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:\Python36\lib\site-packages\pip\utils\packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:\Python36\lib\email\feedparser.py", line 175, in feed
self._input.push(data)
File "C:\Python36\lib\email\feedparser.py", line 103, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
Any help?
Try instead:
pip install kivy
Worked for me on my Windows machine. Make sure pip is in the Path enviornment variable on your machine.
This question already has answers here:
Error installing coremltools
(5 answers)
Closed 5 years ago.
I am trying to convert a caffe model to core ML model.
Please find the error while running pip install coremltools
Collecting coremltools
Using cached coremltools-0.4.0-py2.7-none-any.whl
Requirement already satisfied: numpy>=1.6.2 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from coremltools)
Collecting protobuf>=3.1.0 (from coremltools)
Using cached protobuf-3.3.0.tar.gz
Collecting six>=1.9 (from protobuf>=3.1.0->coremltools)
Using cached six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from protobuf>=3.1.0->coremltools)
Installing collected packages: six, protobuf, coremltools
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/5z/5hfw98ks677_r5rqm498kq1c0000gn/T/pip-DMhcCb-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
I am new to machine learning. Please suggest a solution
As error said - operation is not permitted. I'm Linux not Mac user - but it's probably because you try to do this without root privilages.
You can try sudo pip install coremltools. But generally speaking installing development libraries system-wide is not best practice.
You should definitely use virtualenv.
When I try to install cairosvg it says requirement satisfied.
Requirement already satisfied: cairosvg in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
Requirement already satisfied: cairocffi in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
(from cairosvg)
Requirement already satisfied: lxml in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
(from cairosvg)
Requirement already satisfied: cssselect in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
(from cairosvg)
Requirement already satisfied: pillow in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
(from cairosvg)
Requirement already satisfied: tinycss in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
(from cairosvg)
Requirement already satisfied: cffi>=0.6 in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
(from cairocffi->cairosvg)
Requirement already satisfied: olefile in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
(from pillow->cairosvg)
Requirement already satisfied: pycparser in
c:\users\kshitij\appdata\local\programs\python\python35\lib\site-packages
(from cffi>=0.6->cairocffi->cairosvg)
But when I try to import it in IDLE, it gives the following error:
import cairosvg
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cairosvg\__init__.py", line 29, in <module>
from . import surface
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cairosvg\surface.py", line 24, in <module>
import cairocffi as cairo
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cairocffi\__init__.py", line 41, in <module>
cairo = dlopen(ffi, *CAIRO_NAMES)
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cairocffi\__init__.py", line 34, in dlopen
return ffi.dlopen(names[0]) # pragma: no cover
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cffi\api.py", line 140, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cffi\api.py", line 786, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cffi\api.py", line 781, in _load_backend_lib
raise OSError(msg)
OSError: cannot load library libcairo.so.2: error 0x7e. Additionally,
ctypes.util.find_library() did not manage to locate a library called
'libcairo.so.2'
This might be because ofcairocffi as it is also giving the following error on import:
import cairocffi
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cairocffi\__init__.py", line 41, in <module>
cairo = dlopen(ffi, 'cairo', 'cairo-2')
File "C:\Users\Kshitij\AppData\Local\Programs\Python\Python35\lib\site-
packages\cairocffi\__init__.py", line 38, in dlopen
raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2
I have a 64-bit windows based architecture with python 3.5 and have installed cairocffi-0.8.0 which installed without a problem.
I solved this problem using UniConverter2.0.
My environments is
Python 3.7
Windows 10 x64
Install uniconvertor-2.0rc4-win64_headless.msi,
Find the "dll" sub-directory under the UniConverter installation path.(In my case, C:\Program Files\UniConvertor-2.0rc4\dlls)
Add this "dll" path to the system path.
Close VSCode(or other editor) and reopen the project.
Try to run your code again.
Enjoy!
On trying to install ipython for Python3.4 I get a message that it is already installed.
pip3 install ipython
Requirement already satisfied (use --upgrade to upgrade): ipython in /usr/local/lib/python3.4/site-packages
But when I try to run it with ipython3 notebook I get all this:
Traceback (most recent call last):
File "/usr/local/bin/ipython3", line 11, in <module>
sys.exit(start_ipython())
File "/usr/local/lib/python3.4/site-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 573, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/terminal/ipapp.py", line 321, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/core/application.py", line 369, in initialize
self.parse_command_line(argv)
File "/usr/local/lib/python3.4/site-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 471, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 402, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python3.4/site-packages/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/usr/local/lib/python3.4/site-packages/IPython/html/notebookapp.py", line 67, in <module>
from .services.sessions.sessionmanager import SessionManager
File "/usr/local/lib/python3.4/site-packages/IPython/html/services/sessions/sessionmanager.py", line 7, in <module>
import sqlite3
File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'
Assuming that the last line is the most important
ImportError: No module named '_sqlite3'
I tried to install all sorts of dependencies for it:
apt-get install sqlite3 libsqlite3-dev
When I tried installing Pysqlite via pip3 install pysqlite :
Collecting pysqlite
Using cached pysqlite-2.6.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-ggtq7_wu/pysqlite/setup.py", line 85
print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ggtq7_wu/pysqlite
However Sphinx is already installed. I even reinstalled it.
pip3 install sphinx
Requirement already satisfied (use --upgrade to upgrade): sphinx in /usr/local/lib/python3.4/site-packages
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.3 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): snowballstemmer>=1.1 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.11 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): babel>=1.3 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): sphinx-rtd-theme<0.2,>=0.1 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): alabaster<0.8,>=0.7 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): Pygments>=2.0 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): markupsafe in /usr/local/lib/python3.4/site-packages (from Jinja2>=2.3->sphinx)
Requirement already satisfied (use --upgrade to upgrade): pytz>=0a in /usr/local/lib/python3.4/site-packages (from babel>=1.3->sphinx)
Hence I have not been able to resolve it because evidently that file _sqlite3.so which should be in /usr/local/lib/python3.4/lib-dynload does not exist and I cannot find a way to install it.
I managed to resolve it thanks to the help I got in the comments.
Just putting it here to make it easy for anyone else who may have the same issue to figure out whats going on.
The issue is in using a self compiled version of Python, before the sql dev files were installed. Hence the bindings did not take.
First I had to use sudo apt-get install sqlite3 libsqlite3-dev to get the relevant sqlite files.
Then I had to recompile the Python by using a Source Tarball and executing the following commands to recompile it.
make clean
./configure
make
make install
I got the same issue on CentOS 6.8 and I installed sqlite-devel and then I re-compiled the python and got the issue fixed:
yum install sqlite-devel