I am currently attempting to greate a .exe file with my Python script. When I attempt to run the file, I am getting this message from the command line when I run the .exe:
Traceback (most recent call last):
File "operation.py", line 2, in <module>
File "watchdog\observers\__init__.pyc", line 79, in <module>
File "watchdog\observers\polling.pyc", line 37, in <module>
File "watchdog\utils\dirsnapshot.pyc", line 59, in <module>
ImportError: No module named pathtools.path
Can somebody explain to me what the issue is? I have verified that watchdog is installed correctly.
Edit - Based on the feedback that I have received, it appears that I need to include the watchdog .egg file. Here is my setup.py:
from distutils.core import setup
import py2exe
import pkg_resources
eggs = pkg_resources.require("watchdog")
from setuptools.archive_util import unpack_archive
for egg in eggs:
if os.path.isdir(egg.location):
sys.path.insert(0, egg.location)
continue
unpack_archive(egg.location, eggdir)
eggpacks = set()
eggspth = open("build/eggs.pth", "w")
for egg in eggs:
print egg
eggspth.write(os.path.basename(egg.location))
eggspth.write("\n")
eggpacks.update(egg.get_metadata_lines("top_level.txt"))
eggspth.close()
eggpacks.remove("pkg_resources")
setup(console=['operation.py'])
Unfortunately, I am getting this error:
File "C:\Users\Kevin Li\Documents\Projects\artona-image-monitor\modules\setup.py", line 6, in <module>
from setuptools.archive_util import unpack_archive
File "build\bdist.win32\egg\setuptools\__init__.py", line 12, in <module> from setuptools.extension import Extension
File "build\bdist.win32\egg\setuptools\extension.py", line 7, in <module>
File "build\bdist.win32\egg\setuptools\dist.py", line 33, in <module>
File "build\bdist.win32\egg\setuptools\dist.py", line 29, in _get_unpatched
AssertionError: distutils has already been patched by <class py2exe.Distribution at 0x0270EF48>
Related
I am trying to use cx_freeze to freeze an app that uses Feedparser. The app works perfectly if I launch it from the command line using python. However, when I try to freeze it using cx_freeze, I don't get an error until I try to launch the app. Then I get:
Traceback (most recent call last):
File "/home/ricky/.local/lib/python3.9/site-packages/cx_Freeze/initscripts/__startup__.py", line 66, in run
module.run()
File "/home/ricky/.local/lib/python3.9/site-packages/cx_Freeze/initscripts/Console.py", line 36, in run
exec(code, m.__dict__)
File "main.py", line 8, in <module>
File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/__init__.py", line 28, in <module>
from .api import parse
File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/api.py", line 36, in <module>
from .html import _BaseHTMLProcessor
File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/html.py", line 31, in <module>
from .sgml import *
File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/sgml.py", line 30, in <module>
import sgmllib
ModuleNotFoundError: No module named 'sgmllib'
I know sgmllib is no longer used in Python 3, but since I don't get this error when I launch it from the command line it doesn't seem to be a feedparser issue. Any thoughts?
The cx_Freeze developer helped me with this same issue on Github. Here's the thread.
I have been attempting to get conan running inside of a docker container that also runs gitlab. I have been attempting to follow these two guides here:
https://docs.gitlab.com/omnibus/docker/ ****Using the Selinux version, im on RHEL 7
https://docs.gitlab.com/ee/user/packages/conan_repository/ *********Only get as far as the actual installing of conan
Whenever I then try to run the conan --version command I get an error message stating "no module named _sqlite3". So in order to try and fix that I have tried installing pysqlite3, libsqlite-dev, sqlite3, pretty much any sqlite named package (within the container of course) I can think of but to no success.
Here is the actual stack trace from the conan call in the event that it may give someone some insight into my issue.
Traceback (most recent call last):
File "/opt/gitlab/embedded/bin/conan", line 33, in <module>
sys.exit(load_entry_point('conan==1.32.0', 'console_scripts', 'conan')())
File "/opt/gitlab/embedded/lib/python3.7/site-packages/pkg_resources/__init__.py", line 473, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/opt/gitlab/embedded/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/opt/gitlab/embedded/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2447, in load
return self.resolve()
File "/opt/gitlab/embedded/lib/python3.7/site-packages/pkg_resources/__init__.py", line 2453, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/opt/gitlab/embedded/lib/python3.7/site-packages/conans/conan.py", line 7, in <module>
from conans.client.command import main
File "/opt/gitlab/embedded/lib/python3.7/site-packages/conans/client/command.py", line 16, in <module>
from conans.client.conan_api import Conan, default_manifest_folder, _make_abs_path, ProfileData
File "/opt/gitlab/embedded/lib/python3.7/site-packages/conans/client/conan_api.py", line 11, in <module>
from conans.client.cache.cache import ClientCache
File "/opt/gitlab/embedded/lib/python3.7/site-packages/conans/client/cache/cache.py", line 16, in <module>
from conans.client.store.localdb import LocalDB
File "/opt/gitlab/embedded/lib/python3.7/site-packages/conans/client/store/localdb.py", line 2, in <module>
import sqlite3
File "/opt/gitlab/embedded/lib/python3.7/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/opt/gitlab/embedded/lib/python3.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
Any help would be greatly appreciated.
I am a Python newbie, trying to package a python script as an exe.
I installed pywin32 from here and downloaded pyinstaller from here.
I've kinda been following this video and when I try to package my file as at 4:21, I get the following error:
F:\Softs\PyInstaller-3.2.1\PyInstaller-3.2.1>python pyinstaller.py test.py --onefile
Traceback (most recent call last):
File "pyinstaller.py", line 14, in <module>
from PyInstaller.__main__ import run
File "F:\Softs\PyInstaller-3.2.1\PyInstaller-3.2.1\PyInstaller\__main__.py", line 21, in <module>
import PyInstaller.building.build_main
File "F:\Softs\PyInstaller-3.2.1\PyInstaller-3.2.1\PyInstaller\building\build_main.py", line 32, in <module>
from ..depend import bindepend
File "F:\Softs\PyInstaller-3.2.1\PyInstaller-3.2.1\PyInstaller\depend\bindepend.py", line 38, in <module>
from ..utils.win32.winmanifest import RT_MANIFEST
File "F:\Softs\PyInstaller-3.2.1\PyInstaller-3.2.1\PyInstaller\utils\win32\winmanifest.py", line 97, in <module>
from PyInstaller.utils.win32 import winresource
File "F:\Softs\PyInstaller-3.2.1\PyInstaller-3.2.1\PyInstaller\utils\win32\winresource.py", line 20, in <module>
import pywintypes
File "C:\Python34\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
__import_pywin32_system_module__("pywintypes", globals())
File "C:\Python34\lib\site-packages\win32\lib\pywintypes.py", line 98, in __import_pywin32_system_module__
raise ImportError("No system module '%s' (%s)" % (modname, filename))
ImportError: No system module 'pywintypes' (pywintypes34.dll)
I looked up the error and I can only find solutions for -
ImportError: No system module 'pywintypes' (pywintypes27.dll)
which didn't work for me. Could somebody suggest where I am going wrong? A hint would be good.
The pywintypes38.dll file is actually installed in the folder path:
C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\pywin32_system32
I copied these files from here to this new path:
C:\Users\Asus\AppData\Roaming\Python\Python38\site-packages\win32\lib
and, it worked fine for me.
I'm new to Linux and generally installing packages via command line syntax.
I've tried installing numba (to use jit) into Python and this is the error I receive.I did this originally with GitHub source, and again with Anaconda. Numba appear to be installed correctly in the command line, however when I try to import into Spyder I get the below error
llvmlite imports without error.
>>> import numba
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/numba-0.22.1_13.g1902d7f-py2.7-linux-x86_64.egg/numba/__init__.py", line 7, in <module>
from . import testing, decorators
File "/usr/local/lib/python2.7/dist-packages/numba-0.22.1_13.g1902d7f-py2.7-linux-x86_64.egg/numba/testing.py", line 6, in <module>
from numba import config
File "/usr/local/lib/python2.7/dist-packages/numba-0.22.1_13.g1902d7f-py2.7-linux-x86_64.egg/numba/config.py", line 9, in <module>
import llvmlite.binding as ll
File "/usr/local/lib/python2.7/dist-packages/llvmlite-0.0.0-py2.7.egg/llvmlite/binding/__init__.py", line 6, in <module>
from .dylib import *
File "/usr/local/lib/python2.7/dist-packages/llvmlite-0.0.0-py2.7.egg/llvmlite/binding/dylib.py", line 4, in <module>
from . import ffi
File "/usr/local/lib/python2.7/dist-packages/llvmlite-0.0.0-py2.7.egg/llvmlite/binding/ffi.py", line 43, in <module>
lib = ctypes.CDLL(_lib_name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libllvmlite.so: cannot open shared object file: No such file or directory
I have installed py2exe. I am trying a convert a script in to .exe. Here is my setup script.
from distutils.core import setup
import py2exe
setup(console=['Script1.py'])
When i run this, I am getting import error. The traceback is given below.
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in __main__.__dict__
File "C:\Users\z010388-dev\Desktop\setup.py", line 2, in <module>
import py2exe
File "C:\Python27\lib\site-packages\py2exe\__init__.py", line 9, in <module>
patch_distutils()
File "C:\Python27\lib\site-packages\py2exe\patch_distutils.py", line 68, in patch_distutils
from . import distutils_buildexe
File "C:\Python27\lib\site-packages\py2exe\distutils_buildexe.py", line 91, in <module>
from . import runtime
File "C:\Python27\lib\site-packages\py2exe\runtime.py", line 3, in <module>
from .dllfinder import Scanner, pydll
File "C:\Python27\lib\site-packages\py2exe\dllfinder.py", line 5, in <module>
from . import _wapi
ImportError: cannot import name _wapi
Is anything wrong with my setup script? What is wrong?