I got this message when trying to execute python executable program, build with cxfreeze, but when I execute the python script .py, there is no problems
D:\TEST2000>Get-List-FoldersID-and-Titles.exe Traceback (most recent call last): File "C:\Python-365\lib\site-packages\cx_Freeze\initscripts__startup__.py", line 14, in run module.run() File "C:\Python-365\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run exec(code, m.dict) File "D:\TEST2000\Get-List-FoldersID-and-Titles.py", line 5, in import requests File "C:\Python-365\lib\site-packages\requests__init__.py", line 98, in from . import packages File "C:\Python-365\lib\site-packages\requests\packages.py", line 7, in locals()[package] = import(package) File "C:\Python-365\lib\site-packages\idna__init__.py", line 2, in from .core import * File "C:\Python-365\lib\site-packages\idna\core.py", line 1, in from . import idnadata ImportError: cannot import name 'idnadata'
How do I resolve the ImportError that I am getting?
idnadata is a module from the idna package. When you build the executable with cx_Freeze, use the packages option to include the idna package.
In your setup.py
setup(
options={
"build_exe": {
"packages": ["idna"],
},
},
)
Related
I'm now trying to train my own model in a conda environment, using ABCNet with Ubuntu 16.04, CUDA 10.2. Got a complaint: "libc10_cuda.so: cannot open shared object file: No such file or directory". I reinstalled CUDA-10.2 but the problem still remains. For more details, please see the transcripts below.
OMP_NUM_THREADS=1 python tools/train_net.py --config-file configs/BAText/Pretrain/attn_R_50.yaml OUTPUT_DIR text_pretraining/attn_R_50
Traceback (most recent call last): File "tools/train_net.py", line 40, in from adet.data.dataset_mapper import DatasetMapperWithBasis File "/home/zzr/AdelaiDet/adet/init.py",
line 1, in from adet import modeling File "/home/zzr/AdelaiDet/adet/modeling/init.py",
line 2, in from .fcos import FCOS File "/home/zzr/AdelaiDet/adet/modeling/fcos/init.py",
line 1, in from .fcos import FCOS File "/home/zzr/AdelaiDet/adet/modeling/fcos/fcos.py",
line 10, in from adet.layers import DFConv2d, NaiveGroupNorm File "/home/zzr/AdelaiDet/adet/layers/init.py",
line 5, in from .bezier_align import BezierAlign File "/home/zzr/AdelaiDet/adet/layers/bezier_align.py",
line 7, in from adet import _C
ImportError: libc10_cuda.so: cannot open shared object file: No such file or directory
I'm trying to install the transformers library on HPC. I do:
git clone https://github.com/huggingface/transformers.git
cd transformers
pip install -e . --user
All three of these work as expected, with the last output being:
Successfully installed dataclasses-0.7 numpy-1.19.0 tokenizers-0.8.1rc2 transformers
Then, I try python -c "import transformers" but I get the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/maths/btech/mt1170727/transformers/src/transformers/__init__.py", line 23, in <module>
from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig
File "/home/maths/btech/mt1170727/transformers/src/transformers/configuration_albert.py", line 18, in <module>
from .configuration_utils import PretrainedConfig
File "/home/maths/btech/mt1170727/transformers/src/transformers/configuration_utils.py", line 25, in <module>
from .file_utils import CONFIG_NAME, cached_path, hf_bucket_url, is_remote_url
File "/home/maths/btech/mt1170727/transformers/src/transformers/file_utils.py", line 37, in <module>
import torch
File "/home/soft/PYTHON/3.6.0/ucs4/gnu/447/lib/python3.6/site-packages/torch/__init__.py", line 125, in <module>
_load_global_deps()
File "/home/soft/PYTHON/3.6.0/ucs4/gnu/447/lib/python3.6/site-packages/torch/__init__.py", line 83, in _load_global_deps
ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL)
File "/home/soft/PYTHON/3.6.0/ucs4/gnu/447/lib/python3.6/ctypes/__init__.py", line 344, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libnvToolsExt.so.1: cannot open shared object file: No such file or directory
I have done as was written in the documentation, and can't see why I'm facing this error. Any help would be great. Thanks...
I am using MacOS X 10.11.2 and I want to install Anaconda 3, so that I downloaded the Anaconda3-4.3.0-MacOSX-x86_64.pkg from here. After I installed, I tried runnging this but I got the error like the following.
S0106602ad06e3352:bin jouk$ conda
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/common/configuration.py", line 38, in <module>
from ruamel_yaml.comments import CommentedSeq, CommentedMap
ImportError: No module named 'ruamel_yaml'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/conda", line 7, in <module>
from conda.cli.main import main
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/cli/__init__.py", line 8, in <module>
from .main import main # NOQA
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/cli/main.py", line 46, in <module>
from ..base.context import context
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/base/context.py", line 18, in <module>
from ..common.configuration import (Configuration, MapParameter, PrimitiveParameter,
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/conda/common/configuration.py", line 40, in <module>
from ruamel.yaml.comments import CommentedSeq, CommentedMap # pragma: no cover
ImportError: No module named 'ruamel'
S0106602ad06e3352:bin jouk$
I tried solving this error with this workaround (here). But in this case is for the case in which I installed Anaconda twice to two places in local. But, I didn't do that. What is my problem?
I've written a python script using scrapy to crawl a site, and I'm trying to set up a job through jenkins to call the script nightly (this way it's very easy to see the output).
The machine I'm running jenkins on is a bitnami VM inside google compute.
I set up the command to run through the shell command in jenkins, and it's failing with the following error:
Building on master in workspace /opt/bitnami/apps/jenkins/jenkins_home/jobs/Scrape and Import myco/workspace [workspace] $ /bin/sh -xe /opt/bitnami/apache-tomcat/temp/hudson4165433582945317339.sh
+ /usr/local/myco/myscript.py -l /usr/local/myco/results/7.log -o /usr/local/myco/results/7.json -s /usr/local/myco/results/7.stats myspider
Traceback (most recent call last): File "/usr/local/myco/myscript.py", line 5, in <module>
from twisted.internet import reactor File "/usr/local/lib/python2.7/dist-packages/twisted/internet/reactor.py", line 38, in <module>
from twisted.internet import default File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 56, in <module>
install = _getInstallFunction(platform) File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 44, in _getInstallFunction
from twisted.internet.epollreactor import install File "/usr/local/lib/python2.7/dist-packages/twisted/internet/epollreactor.py", line 24, in <module>
from twisted.internet import posixbase File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 23, in <module>
from twisted.internet import error, udp, tcp File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 29, in <module>
from twisted.internet._newtls import ( File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_newtls.py", line 21, in <module>
from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol File "/usr/local/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 41, in <module>
from OpenSSL.SSL import Error, ZeroReturnError, WantReadError File "/usr/local/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import rand, crypto, SSL File "/usr/local/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
from OpenSSL._util import ( File "/usr/local/lib/python2.7/dist-packages/OpenSSL/_util.py", line 7, in <module>
binding = Binding() File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 114, in __init__
self._ensure_ffi_initialized() File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 126, in _ensure_ffi_initialized
cls._modules, File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/bindings/utils.py", line 31, in load_library_for_binding
lib = ffi.verifier.load_library() File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 97, in load_library
return self._load_library() File "/usr/local/lib/python2.7/dist-packages/cffi/verifier.py", line 207, in _load_library
return self._vengine.load_library() File "/usr/local/lib/python2.7/dist-packages/cffi/vengine_cpy.py", line 155, in load_library
raise ffiplatform.VerificationError(error) cffi.ffiplatform.VerificationError: importing '/usr/local/lib/python2.7/dist-packages/cryptography/_Cryptography_cffi_e7d09016xc302a38b.so': /usr/local/lib/python2.7/dist-packages/cryptography/_Cryptography_cffi_e7d09016xc302a38b.so: symbol EC_GFp_nistp521_method, version OPENSSL_1.0.1 not defined in file libcrypto.so.1.0.0 with link time reference Build step 'Execute shell' marked build as failure Finished: FAILURE
I'm perplexed because when I run the same command (as my user and the user jenkins is running under, tomcat) I don't get this error, the script works fine.
I suspect this may have to do with the script being executed inside apache, but I'm at my wits end and googling hasn't turned up any obvious solutions.
Any idea as to how to solve this?
symbol EC_GFp_nistp521_method, version OPENSSL_1.0.1 not defined in file libcrypto.so.1.0.0
It looks like you are running a python compiled with OpenSSL 1.0.1 with a libcrypto from OpenSSL 1.0.0. It might be because you are running with a different python (at least compiled against a different OpenSSL version) but include files from your local python installation which expects the newer OpenSSL.
Using cx_freeze under ubuntu 12.04. The generation of the package is
done without any errors but when I try to run the package as a
standalone, I get the following error:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/initscripts /Console.py",
line 27, in <module>
exec code in m.__dict__
m m File "Setup_cx_freeze.py", line 3, in <module>
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/__init__.py",
line 4, in <module>
from cx_Freeze.dist import *
File "/usr/local/lib/python2.7/dist-packages/cx_Freeze/dist.py",
line 3, in <module>
import distutils.command.install
File "/usr/lib/python2.7/distutils/command/install.py", line 21, in <module>
from site import USER_BASE
File "/usr/lib/python2.7/site.py", line 562, in <module>
main()
File "/usr/lib/python2.7/site.py", line 540, in main
abs__file__()
File "/usr/lib/python2.7/site.py", line 100, in abs__file__
m.__file__ = os.path.abspath(m.__file__)
File "/usr/lib/python2.7/email/__init__.py", line 79, in __getattr__
__import__(self.__name__)
ImportError: No module named image
I think what to focus on is the last sentence. "ImportError: No module named image."
The application runs without any problems in pure python environment
So why do I get the Error when running it as a "freeze" package? The
fault is somehow introduced when generating the freeze-package.
I ended up fixing this by explicitly including the package "email.mime" in the setup.py script build exe options.
Missing 'image' is just first part of the problem. Try to add this to your code:
from email.mime.image import MIMEImage
from email.mime.audio import MIMEAudio
from email.mime.message import MIMEMessage
This resolved problems with 'image', 'audio' and 'message'.
Resolved this by installing Python Imaging Library: http://www.pythonware.com/products/pil/
1) python setup.py build
2) sudo python setup.py install