Minimal example opencv, pyinstaller, conda - python

I'm trying to get a minimal example working using pyinstaller and opencv inside a conda environment.
So far, what I'm doing is:
conda create -n minimal_example python=3 pyinstaller opencv
which leaves me with the following packages:
# Name Version Build Channel
altgraph 0.17 py_0
blas 1.0 mkl
ca-certificates 2020.1.1 0
certifi 2020.6.20 py38_0
future 0.18.2 py38_1
hdf5 1.10.4 h7ebc959_0
icc_rt 2019.0.0 h0cc432a_1
intel-openmp 2020.1 216
jpeg 9b hb83a4c4_2
libopencv 4.0.1 hbb9e17c_0
libpng 1.6.37 h2a8f88b_0
libtiff 4.1.0 h56a325e_1
lz4-c 1.9.2 h62dcd97_0
macholib 1.11 py_0
mkl 2020.1 216
mkl-service 2.3.0 py38hb782905_0
mkl_fft 1.1.0 py38h45dec08_0
mkl_random 1.1.1 py38h47e9c7a_0
numpy 1.18.5 py38h6530119_0
numpy-base 1.18.5 py38hc3f5095_0
opencv 4.0.1 py38h2a7c758_0
openssl 1.1.1g he774522_0
pefile 2019.4.18 py_0
pip 20.1.1 py38_1
py-opencv 4.0.1 py38he44ac1e_0
pycryptodome 3.8.2 py38he774522_0
pyinstaller 3.6 py38h62dcd97_5
python 3.8.3 he1778fa_0
pywin32 227 py38he774522_1
pywin32-ctypes 0.2.0 py38_1000
setuptools 47.3.1 py38_0
six 1.15.0 py_0
sqlite 3.32.3 h2a8f88b_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_2
wheel 0.34.2 py38_0
wincertstore 0.2 py38_0
xz 5.2.5 h62dcd97_0
zlib 1.2.11 h62dcd97_4
zstd 1.4.4 ha9fde0e_3
I have a script called minimal_build.py with the following content:
print('Importing numpy')
import numpy as np
print(np.__version__)
print(np.__file__)
print('Importing OpenCV')
import cv2
I'm trying to package that script into an executable running
pyinstaller minimal_build.py
When running the resulting exe, I get the following output:
Importing numpy
C:\Users\me\Anaconda3\envs\minimal_example\lib\site-packages\PyInstaller\loader\pyimod03_importers.py:623: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
exec(bytecode, module.__dict__)
Traceback (most recent call last):
File "minimal_build.py", line 10, in <module>
File "C:\Users\me\Anaconda3\envs\minimal_example\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\numpy\__init__.py", line 235, in <module>
File "C:\Users\me\Anaconda3\envs\minimal_example\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\mkl\__init__.py", line 54, in <module>
File "mkl\_mkl_service.pyx", line 27, in init mkl._py_mkl_service
ModuleNotFoundError: No module named 'six'
[9644] Failed to execute script minimal_build
So I'm guessing, that it tries to import numpy from my user folder instead of the package. What am I doing wrong?

I happened to have the same problem as you
Here is the solution I tried:
conda create -n minimal_example python=3.7 pyinstaller
conda activate minimal_example
pip install opencv-python
not conda install opencv
my conda list:
# Name Version Build Channel
altgraph 0.17 py_0 defaults
ca-certificates 2020.1.1 0 defaults
certifi 2020.6.20 py37_0 defaults
future 0.18.2 py37_1 defaults
macholib 1.11 py_0 defaults
numpy 1.19.0 pypi_0 pypi
opencv-python 4.2.0.34 pypi_0 pypi
openssl 1.1.1g he774522_0 defaults
pefile 2019.4.18 py_0 defaults
pip 20.1.1 py37_1 defaults
pycryptodome 3.8.2 py37he774522_0 defaults
pyinstaller 3.6 py37h62dcd97_5 defaults
python 3.7.7 h81c818b_4 defaults
pywin32 227 py37he774522_1 defaults
pywin32-ctypes 0.2.0 py37_1000 defaults
setuptools 47.3.1 py37_0 defaults
sqlite 3.32.3 h2a8f88b_0 defaults
tqdm 4.46.1 py_0 defaults
vc 14.1 h0510ff6_4 defaults
vs2015_runtime 14.16.27012 hf0eaf9b_2 defaults
wheel 0.34.2 py37_0 defaults
wincertstore 0.2 py37_0 defaults
zlib 1.2.11 h62dcd97_4 defaults
then
pyinstaller -F path/to/your/python-file -p path/to/your/venv/python.exe

Related

AttributeError: 'ParquetFile' object has no attribute 'row_groups'

Pythonistas!
Not sure what I am doing wrong while reading a parquet file here.
I have all the necessary packages installed - pandas, fastparquet & pyarrow
The code literally is reading the parquet file
import pandas as pd
FILE = 'file://minute_equities_all/minute/A/AA.parquet'
pd = pd.read_parquet(FILE,engine='fastparquet')
This keeps giving me,
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pandas/io/parquet.py", line 493, in read_parquet
return impl.read(
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pandas/io/parquet.py", line 347, in read
result = parquet_file.to_pandas(columns=columns, **kwargs)
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/fastparquet/api.py", line 722, in to_pandas
rgs = filter_row_groups(self, filters) if filters else self.row_groups
AttributeError: 'ParquetFile' object has no attribute 'row_groups'
Changing the engine to pyarrow also doesn't help -
Traceback (most recent call last):
File "/Users/ppatel/Desktop/development/data-sync/main.py", line 5, in <module>
pf = pd.read_parquet(FILE,engine='pyarrow')
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pandas/io/parquet.py", line 493, in read_parquet
return impl.read(
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pandas/io/parquet.py", line 240, in read
result = self.api.parquet.read_table(
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pyarrow/parquet/__init__.py", line 2737, in read_table
dataset = _ParquetDatasetV2(
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pyarrow/parquet/__init__.py", line 2351, in __init__
self._dataset = ds.dataset(path_or_paths, filesystem=filesystem,
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pyarrow/dataset.py", line 694, in dataset
return _filesystem_dataset(source, **kwargs)
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pyarrow/dataset.py", line 439, in _filesystem_dataset
fs, paths_or_selector = _ensure_single_source(source, filesystem)
File "/Users/ppatel/opt/miniconda3/envs/quant/lib/python3.10/site-packages/pyarrow/dataset.py", line 415, in _ensure_single_source
raise FileNotFoundError(path)
FileNotFoundError: /Users/ppatel/Desktop/development/data-sync/minute_equities_all/minute/A/AA.parquet
Am I missing something here? Any help will be appreciated!
Attaching an example file here (expires in 30 days) - https://easyupload.io/xsqhhw
Adding some details around package versions -
# Name Version Build Channel
abseil-cpp 20211102.0 he49afe7_0 conda-forge
arrow-cpp 8.0.0 py310h72c8010_0
aws-c-common 0.4.57 hb1e8313_1
aws-c-event-stream 0.1.6 h23ab428_5
aws-checksums 0.1.9 hb1e8313_0
aws-sdk-cpp 1.8.185 he271ece_0
beautifulsoup4 4.11.1 py310hecd8cb5_0
blas 1.0 mkl
boost-cpp 1.70.0 hd59e818_1 conda-forge
bottleneck 1.3.5 py310h4e76f89_0
brotli 1.0.9 hca72f7f_7
brotli-bin 1.0.9 hca72f7f_7
brotlipy 0.7.0 py310h1961e1f_1004 conda-forge
bs4 4.11.1 hd3eb1b0_0
bzip2 1.0.8 h1de35cc_0
c-ares 1.18.1 h0d85af4_0 conda-forge
ca-certificates 2022.6.15.1 h033912b_0 conda-forge
certifi 2022.6.15.1 pyhd8ed1ab_0 conda-forge
cffi 1.15.1 py310hc55c11b_0
charset-normalizer 2.1.1 pyhd8ed1ab_0 conda-forge
cramjam 2.5.0 py310hcf052fe_0 conda-forge
cryptography 37.0.4 py310h52c3658_0 conda-forge
cycler 0.11.0 pyhd3eb1b0_0
et_xmlfile 1.0.1 py_1001 conda-forge
fastparquet 0.8.3 py310h936d966_0 conda-forge
fonttools 4.25.0 pyhd3eb1b0_0
freetype 2.11.0 hd8bbffd_0
fsspec 2022.8.2 pyhd8ed1ab_0 conda-forge
gflags 2.2.2 hb1e8313_1004 conda-forge
giflib 5.2.1 haf1e3a3_0
glog 0.5.0 h25b26a9_0 conda-forge
grpc-cpp 1.46.1 h067a048_0
icu 58.2 h0a44026_1000 conda-forge
idna 3.3 pyhd8ed1ab_0 conda-forge
intel-openmp 2021.4.0 hecd8cb5_3538
jpeg 9e hca72f7f_0
kiwisolver 1.4.2 py310he9d5cce_0
krb5 1.19.2 hcd88c3b_0
lcms2 2.12 hf1fd2bf_0
lerc 3.0 he9d5cce_0
libbrotlicommon 1.0.9 hca72f7f_7
libbrotlidec 1.0.9 hca72f7f_7
libbrotlienc 1.0.9 hca72f7f_7
libcurl 7.84.0 h6dfd666_0
libcxx 12.0.0 h2f01273_0
libdeflate 1.8 h9ed2024_5
libedit 3.1.20210910 hca72f7f_0
libev 4.33 haf1e3a3_1 conda-forge
libevent 2.1.10 h815e4d9_4 conda-forge
libffi 3.3 hb1e8313_2
libiconv 1.17 hac89ed1_0 conda-forge
libnghttp2 1.46.0 ha29bfda_0
libpng 1.6.37 ha441bb4_0
libprotobuf 3.20.1 h8346a28_0
libssh2 1.10.0 h7535e13_3 conda-forge
libta-lib 0.4.0 haf1e3a3_0 conda-forge
libthrift 0.15.0 h054ceb0_0
libtiff 4.4.0 h2ef1027_0
libwebp 1.2.2 h56c3ce4_0
libwebp-base 1.2.2 hca72f7f_0
libxml2 2.9.14 hbf8cd5e_0
libxslt 1.1.35 h5b33f42_0
libzlib 1.2.12 hfe4f2af_2 conda-forge
lxml 4.9.1 py310h6c45266_0 conda-forge
lz4-c 1.9.3 h23ab428_1
matplotlib 3.5.2 py310hecd8cb5_0
matplotlib-base 3.5.2 py310hfb0c5b7_0
mkl 2021.4.0 hecd8cb5_637
mkl-service 2.4.0 py310hca72f7f_0
mkl_fft 1.3.1 py310hf879493_0
mkl_random 1.2.2 py310hc081a56_0
multitasking 0.0.9 pyhd8ed1ab_0 conda-forge
munkres 1.1.4 py_0
ncurses 6.3 hca72f7f_3
numexpr 2.8.3 py310hdcd3fac_0
numpy 1.23.1 py310hdcd3fac_0
numpy-base 1.23.1 py310hfd2de13_0
oandapyv20 0.7.2 pypi_0 pypi
openpyxl 3.0.9 pyhd8ed1ab_0 conda-forge
openssl 1.1.1q hfe4f2af_0 conda-forge
orc 1.7.4 h9274d09_0
packaging 21.3 pyhd3eb1b0_0
pandas 1.4.3 py310he9d5cce_0
pillow 9.2.0 py310hde71d04_1
pip 22.1.2 py310hecd8cb5_0
pyarrow 8.0.0 py310h53e4f6e_0
pycparser 2.21 pyhd8ed1ab_0 conda-forge
pyopenssl 22.0.0 pyhd8ed1ab_0 conda-forge
pyparsing 3.0.9 py310hecd8cb5_0
pysocks 1.7.1 pyha2e5f31_6 conda-forge
python 3.10.4 hdfd78df_0
python-dateutil 2.8.2 pyhd3eb1b0_0
python_abi 3.10 2_cp310 conda-forge
pytz 2022.1 py310hecd8cb5_0
re2 2022.04.01 he9d5cce_0
readline 8.1.2 hca72f7f_1
requests 2.28.1 pyhd8ed1ab_1 conda-forge
setuptools 63.4.1 py310hecd8cb5_0
six 1.16.0 pyhd3eb1b0_1
snappy 1.1.9 he9d5cce_0
soupsieve 2.3.1 pyhd3eb1b0_0
sqlite 3.39.2 h707629a_0
ta-lib 0.4.19 py310h7f5fb2b_4 conda-forge
tk 8.6.12 h5d9f67b_0
tornado 6.2 py310hca72f7f_0
tzdata 2022a hda174b7_0
urllib3 1.26.11 pyhd8ed1ab_0 conda-forge
utf8proc 2.6.1 h9ed2024_0
wheel 0.37.1 pyhd3eb1b0_0
xz 5.2.5 hca72f7f_1
yfinance 0.1.74 pyhd8ed1ab_0 conda-forge
zlib 1.2.12 h4dc903c_2
zstd 1.5.2 hcb37349_0
I am suffering similar issue with you. It can be possible to have file path issue. In my case, when i tried to access S3 file, happened that error. and this is permission issue to access S3.

I cannot use opencv2 and received ImportError: libgl.so.1 cannot open shared object file no such file or directory

**env:**ubuntu16.04 anaconda3 python3.7.8 cuda10.0 gcc5.5
command:
conda activate myenv
python
import cv2
error:
Traceback (most recent call last):
File "", line 1, in
File "/home/.conda/envs/myenv/lib/python3.7/site-packages/cv2/__init__.py", line 5, in
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
I tried:
RUN apt install libgl1-mesa-glx -y
RUN apt-get install 'ffmpeg'\
'libsm6'\
'libxext6' -y
but this is already installed and the latest version(libgl1-mesa-glx18.0.5-0ubuntu0~16.04.1).
then i tried:
sudo apt-get install --reinstall libgl1-mesa-glx
it doesn't work.
finally,I tried to remove the package:
sudo apt-get --purge remove libgl1-mesa-glx
another error occurred:
Reading package list... Done
Analyzing the dependency tree of the package
Reading status information... Done
Some packages cannot be installed. If you are using an unstable distribution, this may be
Because the system cannot reach the state you requested. There may be some software you need in this version
The packages have not been created yet or they have been moved out of the Incoming directory.
The following information may be helpful in solving the problem:
The following packages have unmet dependencies:
libqt5multimedia5-plugins: Dependency: libqgsttools-p1 (>= 5.5.1) but it will not be installed
E: Error, pkgProblemResolver::Resolve failed. This may be due to a software package being required to maintain the status quo.
Any help would be really helpful.Thanks in advance.
conda list:
# packages in environment at /home/lwy/.conda/envs/mmdet1:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
_openmp_mutex 4.5 1_gnu https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
addict 2.3.0 <pip>
albumentations 0.5.1 <pip>
appdirs 1.4.4 <pip>
asynctest 0.13.0 <pip>
attrs 20.2.0 <pip>
ca-certificates 2020.6.20 hecda079_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
certifi 2020.6.20 py37he5f6b98_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
chardet 3.0.4 <pip>
cityscapesScripts 2.1.7 <pip>
codecov 2.1.10 <pip>
coloredlogs 14.0 <pip>
coverage 5.3 <pip>
cycler 0.10.0 <pip>
Cython 0.29.21 <pip>
decorator 4.4.2 <pip>
flake8 3.8.4 <pip>
future 0.18.2 <pip>
humanfriendly 8.2 <pip>
idna 2.10 <pip>
imagecorruptions 1.1.0 <pip>
imageio 2.9.0 <pip>
imgaug 0.4.0 <pip>
importlib-metadata 2.0.0 <pip>
iniconfig 1.1.1 <pip>
isort 5.6.4 <pip>
kiwisolver 1.3.1 <pip>
kwarray 0.5.10 <pip>
ld_impl_linux-64 2.35 h769bd43_9 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libffi 3.2.1 1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
libgcc-ng 9.3.0 h5dbcf3e_17 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libgomp 9.3.0 h5dbcf3e_17 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
libstdcxx-ng 9.3.0 h2ae2ef3_17 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
matplotlib 3.3.2 <pip>
mccabe 0.6.1 <pip>
mmcv 1.1.6 <pip>
mmdet 1.2.0+unknown <pip>
ncurses 6.2 he1b5a44_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
networkx 2.5 <pip>
numpy 1.19.4 <pip>
opencv-python 4.4.0.46 <pip>
openssl 1.1.1h h516909a_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
ordered-set 4.0.2 <pip>
packaging 20.4 <pip>
Pillow 6.2.2 <pip>
pip 20.2.4 py_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pluggy 0.13.1 <pip>
py 1.9.0 <pip>
pycocotools 2.0 <pip>
pycodestyle 2.6.0 <pip>
pyflakes 2.2.0 <pip>
pyparsing 2.4.7 <pip>
pyquaternion 0.9.9 <pip>
pytest 6.1.2 <pip>
pytest-cov 2.10.1 <pip>
pytest-runner 5.2 <pip>
python 3.7.8 h6f2ec95_1_cpython https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
python-dateutil 2.8.1 <pip>
python_abi 3.7 1_cp37m https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
PyWavelets 1.1.1 <pip>
PyYAML 5.3.1 <pip>
readline 8.0 he28a2e2_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
requests 2.24.0 <pip>
scikit-image 0.17.2 <pip>
scipy 1.5.3 <pip>
setuptools 49.6.0 py37he5f6b98_2 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
Shapely 1.7.1 <pip>
six 1.15.0 <pip>
sqlite 3.33.0 h4cf870e_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
tifffile 2020.10.1 <pip>
tk 8.6.10 hed695b0_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
toml 0.10.2 <pip>
torch 1.5.0+cu92 <pip>
torchvision 0.6.0+cu92 <pip>
tqdm 4.51.0 <pip>
typing 3.7.4.3 <pip>
ubelt 0.9.3 <pip>
urllib3 1.25.11 <pip>
wheel 0.35.1 pyh9f0ad1d_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
xdoctest 0.15.0 <pip>
xz 5.2.5 h516909a_1 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
yapf 0.30.0 <pip>
zipp 3.4.0 <pip>
zlib 1.2.11 0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
Usually these Pacakges are meant to be installed as System Packages and Not only Python packages. Therefore many times even after successfull installation of such packages like opencv, cmake, dlib they don't work.
The Best way is to Install them is using.
sudo apt-get install python3-opencv
This is the Preferred Method for the Successfull Installation of opencv on Ubuntu as per the Official Opencv Docs.
I have solved this problem!
Firstly, find the file:
find /usr -name libGL.so.1
I found /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.
Then, I created a soft link:
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so.1
Finally, I verified that it is valid:
# python
import cv2
I was able to solve the issue by
apt-get install libgl1

Pyinstaller is missing modulename._modulename

I'm using pyinstaller to build an .exe file on windows including a QT GUI and some image read and write functions. In my main python file, I do import tifffile for reading .tiff images. Pyinstaller compiles my project without errors. When I run it, I get a warning in my terminal saying:
path_to_my_project\tifffile\tiffffile.py:8211: UserWarning: No module named 'tifffile._tifffile' Functionality might be degraded or be slow.
However, I can use the parts of my app that use the corresponding functions from the tifffile module. My question now is, how I can fix this or if it's save to ignore, how to suppress the warning.
That's the conda environment I'm using if of any importance:
altgraph 0.16.1 pypi_0 pypi
blas 1.0 mkl
ca-certificates 2019.5.15 1
certifi 2019.6.16 py37_1
dc-imgproc 1.1.1 pypi_0 pypi
future 0.17.1 pypi_0 pypi
hdf5 1.8.20 hac2f561_1
icc_rt 2019.0.0 h0cc432a_1
icu 58.2 ha66f8fd_1
intel-openmp 2019.5 281
jpeg 9b hb83a4c4_2
libopencv 3.4.2 h20b85fd_0
libpng 1.6.37 h2a8f88b_0
libtiff 4.0.10 hb898794_2
macholib 1.11 pypi_0 pypi
mkl 2019.5 281
mkl-service 2.3.0 py37hb782905_0
mkl_fft 1.0.14 py37h14836fe_0
mkl_random 1.0.2 py37h343c172_0
numpy 1.16.5 py37h19fb1c0_0
numpy-base 1.16.5 py37hc3f5095_0
opencv 3.4.2 py37h40b0b35_0
openssl 1.1.1d he774522_0
pefile 2019.4.18 pypi_0 pypi
pip 19.2.2 py37_0
py-opencv 3.4.2 py37hc319ecb_0
pyinstaller 3.5.dev0+gb54a15d7 pypi_0 pypi
pyqt 5.9.2 py37h6538335_2
pyqtgraph 0.10.0 py37h28b3542_3
python 3.7.4 h5263a28_0
pywin32-ctypes 0.2.0 pypi_0 pypi
qt 5.9.7 vc14h73c81de_0
qtpy 1.9.0 py_0
scipy 1.3.1 py37h29ff71c_0
setuptools 41.0.1 py37_0
sip 4.19.8 py37h6538335_0
six 1.12.0 py37_0
sqlite 3.29.0 he774522_0
tifffile 0.15.1 py37h452e1ab_1001 conda-forge
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_0
wheel 0.33.4 py37_0
wincertstore 0.2 py37_0
xz 5.2.4 h2fa13f4_4
zlib 1.2.11 h62dcd97_3
zstd 1.3.7 h508b16e_0
Update I can reproduce the behaviour, if I put only import tifffile into an empty python file and run pyinstaller on it.

Install pytorch fail on win10 external GPU

I can not import pytorch on my gpu conda env:
C:\Users\Jeffy\Desktop
$ python
Python 3.7.2 (default, Feb 11 2019, 14:11:50) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ProgramData\Anaconda3\envs\gpu\lib\site-packages\torch\__init__.py", line 84, in <module>
from torch._C import *
ImportError: DLL load failed: The specified module could not be found.
I have two conda env, one is gpu with external gpu GTX1050, one is base.
On my base env, I have installed pytorch-cpu version and it works well.
However, I cannot install pytorch gpu version on my gpu env.
on my gpu env, I have the following packages installed (including cudnn, intel-openmp, cmake and so on):
$ conda list
packages in environment at C:\ProgramData\Anaconda3\envs\gpu:
Name Version Build Channel
absl-py 0.7.0 pypi_0 pypi
astor 0.7.1 pypi_0 pypi
blas 1.0 mkl
ca-certificates 2019.1.23 0
certifi 2018.11.29 py37_0
cffi 1.11.5 py37h74b6da3_1
cmake 3.12.2 he025d50_0
cudatoolkit 10.0.130 0
cudnn 7.3.1 cuda10.0_0
freetype 2.9.1 ha9979f8_1
gast 0.2.2 pypi_0 pypi
grpcio 1.18.0 pypi_0 pypi
h5py 2.9.0 pypi_0 pypi
icc_rt 2019.0.0 h0cc432a_1
intel-openmp 2019.0 pypi_0 pypi
jpeg 9b hb83a4c4_2
keras-applications 1.0.7 pypi_0 pypi
keras-preprocessing 1.0.9 pypi_0 pypi
libpng 1.6.36 h2a8f88b_0
libtiff 4.0.10 hb898794_2
markdown 3.0.1 pypi_0 pypi
mkl 2019.1 144
mkl-include 2019.1 144
mkl_fft 1.0.10 py37h14836fe_0
mkl_random 1.0.2 py37h343c172_0
mock 2.0.0 pypi_0 pypi
ninja 1.8.2.post2 pypi_0 pypi
numpy 1.15.4 py37h19fb1c0_0
numpy-base 1.15.4 py37hc3f5095_0
olefile 0.46 py37_0
openssl 1.1.1a he774522_0
pbr 5.1.2 pypi_0 pypi
pillow 5.4.1 py37hdc69c19_0
pip 19.0.1 py37_0
protobuf 3.6.1 pypi_0 pypi
pycparser 2.19 py37_0
python 3.7.2 h8c8aaf0_2
pytorch 1.0.1 py3.7_cuda100_cudnn7_1 pytorch
pyyaml 3.13 py37hfa6e2cd_0
setuptools 40.7.3 py37_0
six 1.12.0 py37_0
sqlite 3.26.0 he774522_0
tensorboard 1.12.2 pypi_0 pypi
tensorflow-estimator 1.13.0rc0 pypi_0 pypi
tensorflow-gpu 1.13.0rc1 pypi_0 pypi
termcolor 1.1.0 pypi_0 pypi
tk 8.6.8 hfa6e2cd_0
torchvision 0.2.1 py_2 pytorch
typing 3.6.4 py37_0
vc 14.1 h21ff451_1 peterjc123
vs2015_runtime 14.15.26706 h3a45250_0
vs2017_runtime 15.4.27004.2010 1 peterjc123
werkzeug 0.14.1 pypi_0 pypi
wheel 0.32.3 py37_0
wincertstore 0.2 py37_0
xz 5.2.4 h2fa13f4_4
yaml 0.1.7 hc54c509_2
zlib 1.2.11 h62dcd97_3
zstd 1.3.7 h508b16e_0
Expecting Cuda and Cudnn has been already installed and Updated the Environment variable list.
Try installing pytorch using the command
conda install pytorch -c pytorch
or
conda install pytorch torchvision cudatoolkit=10.0.130 -c pytorch

Python 3.7 anaconda environment - import _ssl DLL load fail error

I created anaconda environment with Python=3.7 and have trouble with the error of _ssl and DLL. When I tried to get back to my base environment, I have trouble getting the background processes to complete as shown in the figure below, this goes on forever.
The error:
C:\Users\abhil\AppData\Local\Continuum\anaconda3\envs\HeisenbergPy37\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.1\helpers\pydev\pydevconsole.py" --mode=client --port=63950
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.1\helpers\pydev\pydevconsole.py", line 5, in <module>
from _pydev_comm.rpc import make_rpc_client, start_rpc_server, start_rpc_server_and_make_client
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.1\helpers\pydev\_pydev_comm\rpc.py", line 4, in <module>
from _pydev_comm.server import TSingleThreadedServer
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.1\helpers\pydev\_pydev_comm\server.py", line 4, in <module>
from _shaded_thriftpy.server import TServer
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.1\helpers\third_party\thriftpy\_shaded_thriftpy\server.py", line 9, in <module>
from _shaded_thriftpy.transport import (
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.1\helpers\third_party\thriftpy\_shaded_thriftpy\transport\__init__.py", line 57, in <module>
from .sslsocket import TSSLSocket, TSSLServerSocket # noqa
File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.1.1\helpers\third_party\thriftpy\_shaded_thriftpy\transport\sslsocket.py", line 7, in <module>
import ssl
File "C:\Users\abhil\AppData\Local\Continuum\anaconda3\envs\HeisenbergPy37\lib\ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.
Process finished with exit code 1
All packages installed with
conda create -n anaconda python=3.7
C:\WINDOWS\system32>conda list
# packages in environment at C:\Users\abhil\AppData\Local\Continuum\anaconda3\envs\HeisenbergPy37:
#
# Name Version Build Channel
alabaster 0.7.12 py37_0
anaconda 2018.12 py37_0
anaconda-client 1.7.2 py37_0
anaconda-project 0.8.2 py37_0
asn1crypto 0.24.0 py37_0
astroid 2.1.0 py37_0
astropy 3.1 py37he774522_0
atomicwrites 1.2.1 py37_0
attrs 18.2.0 py37h28b3542_0
babel 2.6.0 py37_0
backcall 0.1.0 py37_0
backports 1.0 py37_1
backports.os 0.1.1 py37_0
backports.shutil_get_terminal_size 1.0.0 py37_2
beautifulsoup4 4.6.3 py37_0
bitarray 0.8.3 py37hfa6e2cd_0
bkcharts 0.2 py37_0
blas 1.0 mkl
blaze 0.11.3 py37_0
bleach 3.0.2 py37_0
blosc 1.14.4 he51fdeb_0
bokeh 1.0.2 py37_0
boto 2.49.0 py37_0
bottleneck 1.2.1 py37h452e1ab_1
bzip2 1.0.6 hfa6e2cd_5
ca-certificates 2018.03.07 0
certifi 2018.11.29 py37_0
cffi 1.11.5 py37h74b6da3_1
chardet 3.0.4 py37_1
click 7.0 py37_0
cloudpickle 0.6.1 py37_0
clyent 1.2.2 py37_1
colorama 0.4.1 py37_0
comtypes 1.1.7 py37_0
console_shortcut 0.1.1 3
contextlib2 0.5.5 py37_0
cryptography 2.4.2 py37h7a1dbc1_0
curl 7.63.0 h2a8f88b_1000
cycler 0.10.0 py37_0
cython 0.29.2 py37ha925a31_0
cytoolz 0.9.0.1 py37hfa6e2cd_1
dask 1.0.0 py37_0
dask-core 1.0.0 py37_0
datashape 0.5.4 py37_1
decorator 4.3.0 py37_0
defusedxml 0.5.0 py37_1
distributed 1.25.1 py37_0
docutils 0.14 py37_0
entrypoints 0.2.3 py37_2
et_xmlfile 1.0.1 py37_0
fastcache 1.0.2 py37hfa6e2cd_2
filelock 3.0.10 py37_0
flask 1.0.2 py37_1
flask-cors 3.0.7 py37_0
freetype 2.9.1 ha9979f8_1
get_terminal_size 1.0.0 h38e98db_0
gevent 1.3.7 py37he774522_1
glob2 0.6 py37_1
greenlet 0.4.15 py37hfa6e2cd_0
h5py 2.8.0 py37h3bdd7fb_2
hdf5 1.10.2 hac2f561_1
heapdict 1.0.0 py37_2
html5lib 1.0.1 py37_0
icc_rt 2019.0.0 h0cc432a_1
icu 58.2 ha66f8fd_1
idna 2.8 py37_0
imageio 2.4.1 py37_0
imagesize 1.1.0 py37_0
importlib_metadata 0.6 py37_0
intel-openmp 2019.1 144
ipykernel 5.1.0 py37h39e3cac_0
ipython 7.2.0 py37h39e3cac_0
ipython_genutils 0.2.0 py37_0
ipywidgets 7.4.2 py37_0
isort 4.3.4 py37_0
itsdangerous 1.1.0 py37_0
jdcal 1.4 py37_0
jedi 0.13.2 py37_0
jinja2 2.10 py37_0
jpeg 9b hb83a4c4_2
jsonschema 2.6.0 py37_0
jupyter 1.0.0 py37_7
jupyter_client 5.2.4 py37_0
jupyter_console 6.0.0 py37_0
jupyter_core 4.4.0 py37_0
jupyterlab 0.35.3 py37_0
jupyterlab_server 0.2.0 py37_0
keyring 17.0.0 py37_0
kiwisolver 1.0.1 py37h6538335_0
krb5 1.16.1 hc04afaa_7
lazy-object-proxy 1.3.1 py37hfa6e2cd_2
libarchive 3.3.3 h0643e63_5
libcurl 7.63.0 h2a8f88b_1000
libiconv 1.15 h1df5818_7
libpng 1.6.35 h2a8f88b_0
libsodium 1.0.16 h9d3ae62_0
libssh2 1.8.0 h7a1dbc1_4
libtiff 4.0.9 h36446d0_2
libxml2 2.9.8 hadb2253_1
libxslt 1.1.32 hf6f1972_0
llvmlite 0.26.0 py37ha925a31_0
locket 0.2.0 py37_1
lxml 4.2.5 py37hef2cd61_0
lz4-c 1.8.1.2 h2fa13f4_0
lzo 2.10 h6df0209_2
m2w64-gcc-libgfortran 5.3.0 6
m2w64-gcc-libs 5.3.0 7
m2w64-gcc-libs-core 5.3.0 7
m2w64-gmp 6.1.0 2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2
markupsafe 1.1.0 py37he774522_0
matplotlib 3.0.2 py37hc8f65d3_0
mccabe 0.6.1 py37_1
menuinst 1.4.14 py37hfa6e2cd_0
mistune 0.8.4 py37he774522_0
mkl 2019.1 144
mkl-service 1.1.2 py37hb782905_5
mkl_fft 1.0.6 py37h6288b17_0
mkl_random 1.0.2 py37h343c172_0
more-itertools 4.3.0 py37_0
mpmath 1.1.0 py37_0
msgpack-python 0.5.6 py37he980bc4_1
msys2-conda-epoch 20160418 1
multipledispatch 0.6.0 py37_0
nbconvert 5.4.0 py37_1
nbformat 4.4.0 py37_0
networkx 2.2 py37_1
nltk 3.4 py37_1
nose 1.3.7 py37_2
notebook 5.7.4 py37_0
numba 0.41.0 py37hf9181ef_0
numexpr 2.6.8 py37hdce8814_0
numpy 1.15.4 py37h19fb1c0_0
numpy-base 1.15.4 py37hc3f5095_0
numpydoc 0.8.0 py37_0
odo 0.5.1 py37_0
olefile 0.46 py37_0
openpyxl 2.5.12 py37_0
openssl 1.1.1a he774522_0
packaging 18.0 py37_0
pandas 0.23.4 py37h830ac7b_0
pandoc 1.19.2.1 hb2460c7_1
pandocfilters 1.4.2 py37_1
parso 0.3.1 py37_0
partd 0.3.9 py37_0
path.py 11.5.0 py37_0
pathlib2 2.3.3 py37_0
patsy 0.5.1 py37_0
pep8 1.7.1 py37_0
pickleshare 0.7.5 py37_0
pillow 5.3.0 py37hdc69c19_0
pip 18.1 py37_0
pkginfo 1.4.2 py37_1
pluggy 0.8.0 py37_0
ply 3.11 py37_0
prometheus_client 0.5.0 py37_0
prompt_toolkit 2.0.7 py37_0
psutil 5.4.8 py37he774522_0
py 1.7.0 py37_0
pycodestyle 2.4.0 py37_0
pycosat 0.6.3 py37hfa6e2cd_0
pycparser 2.19 py37_0
pycrypto 2.6.1 py37hfa6e2cd_9
pycurl 7.43.0.2 py37h7a1dbc1_0
pyflakes 2.0.0 py37_0
pygments 2.3.1 py37_0
pylint 2.2.2 py37_0
pyodbc 4.0.25 py37ha925a31_0
pyopenssl 18.0.0 py37_0
pyparsing 2.3.0 py37_0
pyqt 5.9.2 py37h6538335_2
pysocks 1.6.8 py37_0
pytables 3.4.4 py37he6f6034_0
pytest 4.0.2 py37_0
pytest-arraydiff 0.3 py37h39e3cac_0
pytest-astropy 0.5.0 py37_0
pytest-doctestplus 0.2.0 py37_0
pytest-openfiles 0.3.1 py37_0
pytest-remotedata 0.3.1 py37_0
python 3.7.1 h8c8aaf0_6
python-dateutil 2.7.5 py37_0
python-libarchive-c 2.8 py37_6
pytz 2018.7 py37_0
pywavelets 1.0.1 py37h8c2d366_0
pywin32 223 py37hfa6e2cd_1
pywinpty 0.5.5 py37_1000
pyyaml 3.13 py37hfa6e2cd_0
pyzmq 17.1.2 py37hfa6e2cd_0
qt 5.9.7 vc14h73c81de_0
qtawesome 0.5.3 py37_0
qtconsole 4.4.3 py37_0
qtpy 1.5.2 py37_0
requests 2.21.0 py37_0
rope 0.11.0 py37_0
ruamel_yaml 0.15.46 py37hfa6e2cd_0
scikit-image 0.14.1 py37ha925a31_0
scikit-learn 0.20.1 py37h343c172_0
scipy 1.1.0 py37h29ff71c_2
seaborn 0.9.0 py37_0
send2trash 1.5.0 py37_0
setuptools 40.6.3 py37_0
simplegeneric 0.8.1 py37_2
singledispatch 3.4.0.3 py37_0
sip 4.19.8 py37h6538335_0
six 1.12.0 py37_0
snappy 1.1.7 h777316e_3
snowballstemmer 1.2.1 py37_0
sortedcollections 1.0.1 py37_0
sortedcontainers 2.1.0 py37_0
sphinx 1.8.2 py37_0
sphinxcontrib 1.0 py37_1
sphinxcontrib-websupport 1.1.0 py37_1
spyder 3.3.2 py37_0
spyder-kernels 0.3.0 py37_0
sqlalchemy 1.2.15 py37he774522_0
sqlite 3.26.0 he774522_0
statsmodels 0.9.0 py37h452e1ab_0
sympy 1.3 py37_0
tblib 1.3.2 py37_0
terminado 0.8.1 py37_1
testpath 0.4.2 py37_0
tk 8.6.8 hfa6e2cd_0
toolz 0.9.0 py37_0
tornado 5.1.1 py37hfa6e2cd_0
tqdm 4.28.1 py37h28b3542_0
traitlets 4.3.2 py37_0
unicodecsv 0.14.1 py37_0
urllib3 1.24.1 py37_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.15.26706 h3a45250_0
wcwidth 0.1.7 py37_0
webencodings 0.5.1 py37_1
werkzeug 0.14.1 py37_0
wheel 0.32.3 py37_0
widgetsnbextension 3.4.2 py37_0
win_inet_pton 1.0.1 py37_1
win_unicode_console 0.5 py37_0
wincertstore 0.2 py37_0
winpty 0.4.3 4
wrapt 1.10.11 py37hfa6e2cd_2
xlrd 1.2.0 py37_0
xlsxwriter 1.1.2 py37_0
xlwings 0.15.1 py37_0
xlwt 1.3.0 py37_0
xz 5.2.4 h2fa13f4_4
yaml 0.1.7 hc54c509_2
zeromq 4.2.5 he025d50_1
zict 0.1.3 py37_0
zlib 1.2.11 h62dcd97_3
zstd 1.3.7 h508b16e_0
I have answerd this here, to my understanding this error is caused by the missing/misplacement of libcrypto file in anaconda3/DLLs folder:
From anaconda3\Library\bin copy below files and paste them in anaconda3/DLLs:
- libcrypto-1_1-x64.dll
- libssl-1_1-x64.dll
This can be fixed by manually adding in the PATH variables in PyCharm to the console.
Open your Anaconda cmd
Activate your Conda environment
Get the full PATH value by typing echo %PATH%
if you are on Windows 7/can't copy the output, cd the cmd to your desktop and type echo %PATH% > path_val.txt
this will create a txt file so you can copy/paste the values easier.
In PyCharm, go to Settings -> Build, Execution, Deployment -> Console -> Python Console -> click the folder on the right of Environment variables.
Click the plus button to add a new Environment Variable
The name should be PATH
The value is the entire output from the echo %PATH% command above.
Click OK, then apply.
You can try to set system environment variables, like "C:\Python\Anaconda3;C:\Python\Anaconda3\Scripts;
C:\Python\Anaconda3\Library\bin;".
Only "C:\Python\Anaconda3\Scripts;" is not enough, and it works to me.
I had the same issue on Windows 10 Pro x64 and PyCharm CE 2018.3
A solution that worked for me: Re-install Anaconda3 for all users (with Admin priveledges) and choose "add python.exe to Path" (even though it is nor recommended). Then PyCharm connected successfully without this error.
A work around that also worked: Use another environment (pyenv or conda). It worked for me when I faced the same issue on
Some other suggestions I saw on Internet:
run Anaconda3\Scripts>conda update --all
but this threw the HTTP connection error rises, which might be related.
if running under a virtual env (i.e. your have issued the command: conda activate <env_name>)
The files (libcrypto-1_1-x64.dll and libssl-1_1-x64.dll) to copy are found under:
C:\USER<username>.conda\envs<env_name>\Library\bin
They have to be copied into:
C:\USER<username>.conda\envs<env_name>\DLLs
None of the above worked for me, but instead it was a problem with OpenSSL on Windows 10 Enterprise. I fixed it by downloading and installing OpenSSL from here: https://slproweb.com/products/Win32OpenSSL.html
Thanks for the answer!
This works definately.
I have answerd this here, to my understanding this error is caused by the missing/misplacement of libcrypto file in anaconda3/DLLs folder:
From anaconda3\Library\bin copy below files and paste them in anaconda3/DLLs:
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
In my case the error was a result of spinning pipenv from non-base conda env. Setting variable in PyCharm or moving files in base anaconda structure didn't help, because PyCharm looked for these DLLs in my conda env in the middle.
So I had to move files from base conda structure:
C:\Users<username>\AppData\Local\Continuum\anaconda3\Library\bin
To my conda env from which I spinned the final Pipenv I use in PyCharm:
C:\Users<username>\AppData\Local\Continuum\anaconda3\envs<conda_env_name>\DLLs
The files I had to move to have IPython work correctly:
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
sqlite3.dll
sqlite3.exe
The reason is that not all libraries/binaries are propagated to the virtual envs. Virtual envs are able to find these files in "root Python". Venvs stay lighter thanks to not copying them.
However, PyCharm gets confused in a setup such as mine, and treats the conda env in the middle as a "root Python", and can't find the libraries/bins. This problem can potentially make itself apparent with other dlls or bins.
It may be worth to move all missing files this way.
another solution: edit python3.7's site.py(in Lib dir):
from os.path import join, abspath, dirname
base_path = dirname(dirname(abspath(__file__)))
os.environ['PATH'] = '%s%s' % (
os.environ['PATH'],
join(base_path, 'Library', 'bin'),
)
I had the same issue and my main IDE is Sublime Text 4.
Environment: Windows 10 with Anaconda
What I needed: from cryptography.fernet import Fernet
The marked solution was unachievable for me and the following answer solved it right away:
pip install --upgrade pip
pip uninstall pyopenssl cryptography
pip install pyopenssl cryptography
Validate with:
python -v -c "from OpenSSL import SSL"
Source: https://groups.google.com/g/qatrack/c/24RB6hesOko?pli=1
Incase someone is searching for Eclipse PyDev, It's same as Rob's answer.
No. 4 can be found at Window -> Preferences -> PyDev -> Interpreters -> Python Interpreters -> Environment -> Click New and add PATH
I have updated to Python 3.8 (with miniconda) and it did not work with Pycharm generating "anaconda-environment-import-ssl-dll-load-fail-error". I have tried several proposals here and tweaked env variables in different way w/o much success.
Finally I have updated to Pycharm 2020.2.3 and it worked like a charm, no tweaks ..

Categories