Error in cx_freeze Build - python

I am using cx_freeze to bundle my app. I have 2 questions.
1) I am using OSX Mountain Lion - the /build/exe.macosx-10.8-x86_64-2.7 that I have - will it contain executables for Windows, Linux as well - and if so, where in the list can I find it? My original script is cpu.py. The dir contains a lot of ".so" files and 1 "cpu" file.
2) When I try "cpu" from the list above, I get this output. 'psutil' is a Python module required for the script - cpu.py.
Desktop/build/exe.macosx-10.8-x86_64-2.7/cpu ; exit;
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/cx_Freeze/initscripts/Console.py", line 27, in <module>
exec code in m.__dict__
File "cpu.py", line 6, in <module>
File "/usr/local/lib/python2.7/site-packages/psutil/__init__.py", line 102, in <module>
import psutil._psosx as _psplatform
File "/usr/local/lib/python2.7/site-packages/psutil/_psosx.py", line 14, in <module>
import _psutil_osx
File "build/bdist.macosx-10.8-x86_64/egg/_psutil_osx.py", line 7, in <module>
File "build/bdist.macosx-10.8-x86_64/egg/_psutil_osx.py", line 4, in __bootstrap__
File "build/bdist.macosx-10.8-x86_64/egg/pkg_resources.py", line 945, in resource_filename
File "build/bdist.macosx-10.8-x86_64/egg/pkg_resources.py", line 1626, in get_resource_filename
NotImplementedError: resource_filename() only supported for .egg, not .zip
logout

Related

Python No module named 'Input'

my error is
Traceback (most recent call last):
File "/home/shin/.local/bin/fextractor", line 4, in <module>
__import__('pkg_resources').run_script('VDiscover==0.1', 'fextractor')
File "/home/shin/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 672, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/shin/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1472, in run_script
exec(code, namespace, namespace)
File "/home/shin/.local/lib/python3.8/site-packages/VDiscover-0.1-py3.8.egg/EGG-INFO/scripts/fextractor", line 28, in <module>
from vdiscover.Detection import GetArgs, GetFiles, GetCmd
File "/home/shin/.local/lib/python3.8/site-packages/VDiscover-0.1-py3.8.egg/vdiscover/Detection.py", line 24, in <module>
from Input import Arg, File
ModuleNotFoundError: No module named 'Input'
I think it is related to the input library, so I did pip install input and added the path(./.local/lib/python3.8/site-packages) to the PATH.
But it seems to be a different issue. Could I possibly know a solution?

"This package should not be accessible on Python 3" error

I installed phenix (phenix-installer-1.17.1-3660-intel-linux-2.6-x86_64-centos6) on my CentOS 7 system according the installation guide (https://www.phenix-online.org/documentation/install-setup-run.html). The original python version (/usr/bin/python) in my system is 2.7.5, but I installed anaconda3, so the output of "which python" command is "~/software/build/anaconda3/bin/python".
I tried to study the p9-sad tutorial and run the command "phenix.run_example p9-sad", but it gave the following error information:
Examples to be run: p9-sad
Running PHENIX example: p9-sad Fri Jan 17 15:04:44 CST 2020
Working directory: /home/sunyp/Documents/tutorial/PHENIX/p9-sad
Starting run now ... please wait a moment
Error processing line 1 of /home/sunyp/software/build/anaconda3/lib/python3.7/site-packages/google_auth-1.7.1-py3.6-nspkg.pth:
Fatal Python error: initsite: Failed to import the site module
Traceback (most recent call last):
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 168, in addpackage
exec(line)
File "<string>", line 1, in <module>
File "/home/sunyp/software/build/anaconda3/lib/python3.7/importlib/util.py", line 14, in <module>
from contextlib import contextmanager
File "/home/sunyp/software/build/anaconda3/lib/python3.7/contextlib.py", line 5, in <module>
from collections import deque
File "/home/sunyp/software/build/anaconda3/lib/python3.7/collections/__init__.py", line 27, in <module>
from reprlib import recursive_repr as _recursive_repr
File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/build/../conda_base/lib/python2.7/site-packages/site.py", line 73, in <module>
__boot()
File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/build/../conda_base/lib/python2.7/site-packages/site.py", line 22, in __boot
loader.load_module('site')
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 570, in <module>
main()
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 557, in main
known_paths = addsitepackages(known_paths)
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 349, in addsitepackages
addsitedir(sitedir, known_paths)
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 207, in addsitedir
addpackage(sitedir, name, known_paths)
File "/home/sunyp/software/build/anaconda3/lib/python3.7/site.py", line 178, in addpackage
import traceback
File "/home/sunyp/software/build/anaconda3/lib/python3.7/traceback.py", line 3, in <module>
import collections
File "/home/sunyp/software/build/anaconda3/lib/python3.7/collections/__init__.py", line 27, in <module>
from reprlib import recursive_repr as _recursive_repr
File "/home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py", line 7, in <module>
raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Does it mean that phenix requires python2 rather python3, but there is python3 in my system, so the error came out? And how to solve the problem? Thank you in advance.
Regards,
Yeping Sun
Solely based on /home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/lib/python2.7/site-packages/reprlib/__init__.py Phenix contains a Python 2.7 environment.
You could maybe try running your code with /home/sunyp/software/Phenix/phenix-1.17.1-install/phenix-1.17.1-3660/conda_base/bin/python or something to use that Python interpreter, but it's hard to tell since Phenix source is not openly available.
Your environment probably contains path to python2.7.5
Check your PYTHONPATH
This doesn't work with Python 3 for obvious reasons. To remove it:
unset PYTHONPATH

Installing numba onto Linux 7.0 - error with prerequisite llvmlite library diectory

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

py2exe issue with watchdog library

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>

ImportError: cannot import name output

iam using fabric 0.9.1 version on windows to do some deployment related stuff.
But the moment iam about to run "fab hello" iam facing the following error
D:\pythonscripts>fab hello
Traceback (most recent call last):
File "C:\Python26\Scripts\fab-script.py", line 8, in <module>
load_entry_point('fabric==0.9.1', 'console_scripts', 'fab')()
File "build\bdist.win-amd64\egg\pkg_resources.py", line 318, in load_entry_poi
nt
File "build\bdist.win-amd64\egg\pkg_resources.py", line 2221, in load_entry_po
int
File "build\bdist.win-amd64\egg\pkg_resources.py", line 1954, in load
File "build\bdist.win-amd64\egg\fabric\main.py", line 17, in <module>
File "build\bdist.win-amd64\egg\fabric\api.py", line 9, in <module>
File "build\bdist.win-amd64\egg\fabric\context_managers.py", line 12, in <modu
le>
File "build\bdist.win-amd64\egg\fabric\state.py", line 9, in <module>
File "build\bdist.win-amd64\egg\fabric\network.py", line 19, in <module>
File "build\bdist.win-amd64\egg\fabric\utils.py", line 21, in abort
ImportError: cannot import name output
Any clue on how to resolve this error?
It seems to be this issue: http://code.fabfile.org/issues/show/194, probably it's not Fabric related but PyCrypto or Python64. If it is PyCrypto then the easiest thing is to download a binary version from http://www.voidspace.org.uk/python/modules.shtml#pycrypto and install it and download pywin32 from http://sourceforge.net/projects/pywin32/files/ and install it as well.

Categories