I run the following container to test my opencv-python environment on Windows Server 2016.
docker run -i --rm python:2.7-windowsservercore
(the python:2.7-windowsservercore image is an official python image which is base on microsoft/windowsservercore)
and in the interacive console, I got the opencv-python installed by:
pip install opencv-python
after this finished, I test the opencv-python package by:
python -c "import cv2"
but I got the following error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python\lib\site-packages\cv2\__init__.py", line 9, in <module>
from .cv2 import *
ImportError: DLL load failed: The specified module could not be found.
then I installed python-2.7.13 on the host(not inside container), input the same pip install commands, and test python -c "import cv2" again, it won't report any error. I wonder if there are some DLL files are missing in the container? What package or software should I install in the container to fix this error?
Based on the accepted answer to this question I would put my money on you not having the required MSVC runtime. Assuming it was compiled with Visual Studio 2015 the runtime can be downloaded from Visual C++ Redistributable for Visual Studio 2015
I found the solution in this place.
Copy the following files from your host into your container's \System32 folder:
msacm32.dll
avifil32.dll
avicap32.dll
msvfw32.dll
Related
I have 2 pythons on my computer
One for eclipse and other applications and one for blender.
Computer python version here:
**C:\Users\xxxx\AppData\Local\Programs\Python\Python35-32\Scripts**
Blender (2.79) version is here:
C:\Program Files\Blender Foundation\Blender\2.79\python\bin
I installed pip for Blender (I hope I did) and it is here:
C:\Program Files\Blender Foundation\Blender\2.79\python\lib\site-packages\pip
Then I do this in CMD:
C:\Program Files\Blender Foundation\Blender\2.79\python\lib\site-packages>pip install C:\Users\xxxx\Downloads\pydevd-1.3.2-cp35-cp35m-win32.whl
And get this:
Installing collected packages: pydevd
Found existing installation: pydevd 1.3.0
Uninstalling pydevd-1.3.0:
Successfully uninstalled pydevd-1.3.0
The script pydevd.exe is installed in 'c:\users\xxxx\appdata\local\programs\python\python35-32\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pydevd-1.3.2
But I get this error still in my script under Blender:
Traceback (most recent call last):
File "C:\Users\emamili\Documents\Posao\modeli\blendtest.blend\Run.py", line 9,
in
pydev.debug(SCRIPT, PYDEVD_PATH)
File "C:\Program Files\Blender Foundation\Blender\pydev_debug.py", line 25, in
debug
import pydevd
ImportError: No module named 'pydevd'
Error: Python script fail, look in the console for now...
Your pip seems to be installing it to:
c:\users\xxxx\appdata\local\programs\python\python35-32\ (which is in your Installing collected packages message).
pip is probably mapping to your pip inside python35-32\scripts\pip.exe and by being inside the blender\site-packages doesn't change that.
Search for your pip.exe inside C:\Program Files\Blender Foundation\Blender\2.79\python or execute the python from blender with python -m pip install pydevd.
i'm trying to update the pyodbc package from 4.0.16 to 4.0.22.
i dont have internet access on the machine i'm working on so downloaded the file and copied to across the network.
running
pip install S:\Temp\PMCD\pyodbc-4.0.22-py27hc56fc5f_0(1).tar.bz2
results in the following error:
Processing s:\temp\pmcd\pyodbc-4.0.22-py27hc56fc5f_0(1).tar.bz2
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'c:\\users\\adm_pa~2\\appdata\\local\\temp\\2\\pip-yf25bd-build\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\adm_pa~2\appdata\local\temp\2\pip-yf25bd-build\
setuptools has already been updated to latest(38.5.1) and pip as well (9.0.1)
i used pip to update setuptools and pip itself (via downloaded whl files), so i dont think pip is an issue.
i already managed to sucessfully upgrade pyodbc on my local machine from 16 to 22, so the whl file i have not sure whats going on.
Any ideas whats going on?
Could i manually unzip the package and place it directly in the site-packages? that didnt seem to do anything.
If your target machine does not have a direct Internet connection you can still install pyodbc by
using another machine to download the appropriate wheel (.whl) file from PyPI,
copying that file to your target machine (via LAN, SneakerNet, ...), and
using pip install <wheel_file_location>
For example,
pip install C:\__tmp\pyodbc-4.0.22-cp27-cp27m-win_amd64.whl
The naming convention for wheel files is described in PEP 491.
The 64-bit wheel files for Windows are tagged as "win_amd64" because that's what the Windows version of distutils reports as the platform:
>>> from distutils import util
>>> distutils.util.get_platform()
'win-amd64'
I am using windows 8 and python 3.6.1 I've done the following command in my cmd:
pip install cryptoshop
However, when I run the following python code:
from cryptoshop import encryptfile
from cryptoshop import decryptfile
result1 = encryptfile(filename="test", passphrase="mypassphrase", algo="srp")
print(result1)
result2 = decryptfile(filename="test.cryptoshop", passphrase="mypassphrase")
print(result2)
I get the following error:
Traceback (most recent call last):
File "C:/Users/Owner/Desktop/test.py", line 1, in
from cryptoshop import encryptfile
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop__init__.py", line 26, in
from cryptoshop.cryptoshop import encryptfile
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop\cryptoshop.py", line 56, in
from ._cascade_engine import encry_decry_cascade
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop_cascade_engine.py", line 27, in
from ._nonce_engine import generate_nonce_timestamp
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop_nonce_engine.py", line 39, in
import botan
ModuleNotFoundError: No module named 'botan'
Now, I obviously know that you must install botan into python in order to use it. However, this is where I am running into an issue. I've downloaded Botan from this link as instructed:
https://github.com/randombit/botan
And then I've followed these instructions in an attempt to install Botan:
./configure.py [--prefix=/some/directory]
make
make install
However, when I type make into the command line I get an error saying there is no such command. And then when I go to run my above Python code I still get the no module Botan error. So obviously I am doing something run. How can I properly install Botan into my Python 3.6 directories so that I can use cryptoshop.
I've also attempted to do pip install Botan, as that is how I've installed so many other python libraries but that has been unsuccessful as well.
make is a linux command
According to the botan website you can use nmake as a replacement on windows ( http://wiki.c2.com/?UsingNmake ) :
On Windows
You need to have a copy of Python installed, and have both Python and
your chosen compiler in your path. Open a command shell (or the SDK
shell), and run:
$ python configure.py --cc=msvc (or --cc=gcc for MinGW) [--cpu=CPU]
$ nmake
$ botan-test.exe
$ nmake install
Botan supports the nmake replacement Jom which enables you to run
multiple build jobs in parallel.
source : https://botan.randombit.net/manual/building.html
For completeness, here's how I made it work on a Mac
Assuming you have brew installed.
brew install botan
You may need to install other functionality first:
brew install gmp
brew install mpfr
brew install mpc
Find out where botan got installed with brew info botan.
My location is /usr/local/Cellar/botan/2.6.0
In that folder, you'll find lib/python2.7/site-packages, copy the contents of this folder into your Python's installation site-packages folder.
Note 1: At the time of this writing, only python 2.7 seems to be supported, but I'm using python 3.6 and everything seems to be working.
Note 2: If the file is called botan2.py, you may need to rename it to botan.py in your python's site-packages folder.
I tried to install libsvm downloaded from here http://www.csie.ntu.edu.tw/~cjlin/libsvm/
I already do the stepped written in the README which is
Building Windows Binaries
=========================
Windows binaries are in the directory `windows'. To build them via
Visual C++, use the following steps:
1. Open a DOS command box (or Visual Studio Command Prompt) and change
to libsvm directory. If environment variables of VC++ have not been
set, type
"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
You may have to modify the above command according which version of
VC++ or where it is installed.
2. Type
nmake -f Makefile.win clean all
3. (optional) To build shared library libsvm.dll, type
nmake -f Makefile.win lib
I also copied the libsvm.dll to my windows32 folder.
I cant seem to find anything wrong but when I compiled a python code with "import svm" in it, I got the following error:
$ python analyze.py
Traceback (most recent call last):
File "analyze.py", line 2, in <module>
import baseline_classifier, naive_bayes_classifier, max_entropy_classifier, libsvm_classifier
File "D:\twitter-sentiment-analyzer-master\libsvm_classifier.py", line 1, in <module>
import svm
ImportError: No module named svm
Easy way to install:
Download libsvm's install binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/#libsvm
You might want to install libsvm‑3.17.win‑amd64‑py2.7.exe or libsvm‑3.17.win32‑py2.7.exe depending upon you windows config
I am having a problem installing the Python MySQL connector (MySQL-python-1.2.3c1) on my Mac OSX Snow Leopard.
System State
I have manually compiled an installed:
mysql-5.1.41
This seems to work fine, as I can create and query a database from the commandline.
I have compiled:
MySQL-python-1.2.3c1
I first set the following in the site.cfg file:
mysql_config = /usr/local/mysql/bin/mysql_config
I then built and compiled MySQL-python-1.2.3c1 following their guide:
sudo python setup.py build
sudo python setup.py install
I now test the installation with Python:
python -c "import MySQLdb"
Error Message
This then gives me the following error, and I'm stumped as to how to fix it:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "build/bdist.macosx-10.6-universal/egg/MySQLdb/__init__.py", line 19, in <module>
File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 7, in <module>
File "build/bdist.macosx-10.6-universal/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/username/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so, 2): Symbol not found: _mysql_affected_rows
Referenced from: /Users/username/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
Expected in: flat namespace
in /Users/username/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
mymac: username$
Things I've Tried
I've looked at this blog antoniocangiano.com but it is for an older version of MySQL-python and is not really applicable. But I tried adding the soft link it mentions.
I then looked at this blog post: http://blog.some-abstract-type.com/2009/09/mysql-python-and-mac-os-x-106-snow.html. And tried building compiling with the ARCHFLAGS settings - but no joy.
Please Help
If you have any ideas please let me know.
Many thanks
Ben...
First, I would suggest using the MySQL binaries for MacOS X 10.5 64-bit (x86_64). The tar ball works on MacOS X 10.6.
You said you used ARCHFLAGS.. however, try it again like this:
shell> ARCHFLAGS="-arch x86_64" python setup.py build
shell> sudo python setup.py install
Thus building as normal user, installing as root. (It's good to remove the source, and unpack correcting the site.cfg file again).
What does
otool -L /Users/username/.python-eggs/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg-tmp/_mysql.so
report?