How can I install pdftotext properly?
I'm getting the error message below when installing pdftotext in Python 3.6. I also tried to install the package manually by downloading the zip file but still got the same error.
pdftotext/pdftotext.cpp(4): fatal error C1083: Cannot open include file: 'poppler/cpp/poppler-document.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2
I found some help in the Readme.md file in the pdftotext package :
1) Install OS Dependencies :
on Debian, Ubuntu, and friends:
sudo apt-get update
sudo apt-get install build-essential libpoppler-cpp-dev pkg-config python-dev
on Fedora, Red Hat, and friends:
sudo yum install gcc-c++ pkgconfig poppler-cpp-devel python-devel redhat-rpm-config
2) Do the normal install :
pip install pdftotext
and it worked for me.
I've been trying to figure out how to install pdftotext on Win10 for a few days. Internet searches have given me nothing. So for those who need to know, here's installing pdftotext on Win10 with Anaconda. YMMV.
Install Anaconda Python. There are many articles on installing Anaconda, so I won't explore that here.
Try to run pip install pdftotext, you will get an error that the Microsoft Visual C++ is required.
Navigate in a browser to http://visualstudio.microsoft.com/downloads. Under the Tools for Visual Studio 2019 tab download the Build Tools for Visual Studio 2019. You’ll then install the tools by checking the C++ build tools option box and clicking Install.
You should now get the pip install to move past the VC++ error. Unfortunately you’ll now get the error “Cannot open include file: ‘poppler/cpp/poppler-document.h’. This is because you’re missing the poppler libraries.
Head back to the internets! You’ll need poppler for windows. At the time of this writing, your best option is http://blog.alivate.com.au/poppler-windows. Grab the latest binary, and uncompress it. If you look at the error, pip is looking for the header file at {Anaconda3 directory}\include\poppler\cpp\poppler-document.h. So look in the archive you just unzipped. In the include folder, you’ll see a poppler directory. If you go down into the cpp directory in there you’ll find the poppler-document.h file.
I copied the entire poppler directory into the Anaconda3\include folder, so do that.
If you try to run pip install again, you'll still get a ton of errors! But these are not any of the errors that you saw previously, instead this error is looking for a missing linked library, poppler-cpp.lib. A search through Conda installs on another machine found this file in the poppler package. So
conda install -c conda-forge poppler
Which will install our poppler-cpp.lib file. Then we can copy the file from its home at {Anaconda3 directory}\Library\lib\poppler-cpp.lib and paste it where pdftotext is expecting it at {Anaconda3 directory}\libs.
If we do a pip install pdftotext again, there it is! I’m sure someone will find a way to refine this a bit, but for now we have a working pdftotext Python library on Win10.
These directions can be found, with screenshots, at my blog https://coder.haus/2019/09/27/installing-pdftotext-through-pip-on-windows-10/
Below command solved the problem for me.
sudo apt-get install libpoppler-cpp-dev
https://blog.droidzone.in/2018/05/01/install-pdftotext-python-extension-error/
And for macOS:
brew install poppler
brew install pkg-config poppler python
For Ubuntu users
sudo apt-get install libpoppler58=0.41.0-0ubuntu1 libpoppler-dev libpoppler-cpp-dev
worked for me
Simple solution for windows:
Download the poppler zip file from http://blog.alivate.com.au/wp-content/uploads/2018/10/poppler-0.68.0_x86.7z
Download and install visual studio tools from https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15
Set the folder \poppler-0.68.0\bin to path in the environmental variables.
Thats it. Restart your environment eg could be jupyter notebook, vscode etc. Enjoy
To install pdftotext on Windows 10, I tried to follow Jason Woods' answer.
I want to add to this answer, that it is necessary to have the "C++ Desktop applications development" package installed in Visual Studio.
Make sure to install the "C++ Build Tools" as well, as mentioned in Jason Woods' answer.
Follow the rest of his answer. Quick summary:
install Anaconda Python
in the Anaconda Prompt, type:
conda install -c conda-forge poppler
now install the pdftotext package: pip install pdftotext
It worked for me. Thank you.
Related
I am trying to install a python package that is available on github, but am unsure how to do so. This is the package: https://github.com/Jefferson-Henrique/GetOldTweets-python.
Could someone please provide me clear and step-by-step instructions on how to do this installation? None of the current answers are clear enough for me. I have tried the following command prompt command, but it is not working. I have git installed.
pip install git+https://github.com/Jefferson-Henrique/GetOldTweets-python.git
Error:
Cloning https://github.com/Jefferson-Henrique/GetOldTweets-python.git to c:\users\haris\appdata\local\temp\pip-ocsu8r-build
Error [Error 2] The system cannot find the file specified while executing command git clone -q https://github.com/Jefferson-Henrique/GetOldTweets-python.git c:\users\haris\appdata\local\temp\pip-ocsu8r-build
Cannot find command 'git'
git isn't installed via pip. It's a regular package that you'll want to install by doing apt install git, most likely as root.
You’ll need to install the package outside of pip since it’s not a python package. Conda install will work if you have anaconda or miniconda , or apt get install if you’re on a Linux system. Once you have git, run got clone package_name after navigating to the desired directory and you should be good to go.
I want to use dlib with python for image recognition. I have the python app running great with OpenCV on Windows 10, but when I want to install dlib from the cmd it gives me this following error :
error: Cannot find cmake, ensure it is installed and in the path. You
can install cmake using the instructions at https://cmake.org/install/
You can also specify its path with --cmake parameter.
What should I do?
Install Dlib from .whl
Dlib 19.7.0
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
You can test it, downloading an example from the site, for example SVM_Binary_Classifier.py and running it on your machine.
Note: if this message occurs you have to build dlib from source:
dlib-19.7.0-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform
Install Dlib from source (If the solution above doesn't work)##
Windows Dlib > 19.7.0
Download the CMake installer and install it: https://cmake.org/download/
Add CMake executable path to the Enviroment Variables:
set PATH="%PATH%;C:\Program Files\CMake\bin"
note: The path of the executable could be different from C:\Program Files\CMake\bin, just set the PATH accordingly.
note: The path will be set temporarily, to make the change permanent you have to set it in the “Advanced system settings” → “Environment Variables” tab.
Restart The Cmd or PowerShell window for changes to take effect.
Download the Dlib source(.tar.gz) from the Python Package Index : https://pypi.org/project/dlib/#files extract it and enter into the folder.
Check the Python version: python -V. This is my output: Python 3.7.2 so I'm installing it for Python3.x and not for Python2.x
note: You can install it for both Python 2 and Python 3, if you have set different variables for different binaries i.e: python2 -V, python3 -V
NOTE: Make sure to open the PowerShell as admin, and you're inside the dlib directory before proceeding to step 6
Run the installation: python setup.py install
Linux Dlib 19.17.0
sudo apt-get install cmake
wget https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz
tar -xvzf dlib-19.17.0.tar.gz
cd dlib-19.17.0/
sudo python3 setup.py install
note: To install Dlib for Python 2.x use python instead of python3 you can check your python version via python -V
Follow these steps:
pip install cmake
Install Visual Studio build tools from here.
In Visual Studio 2017 go to the Individual Components tab, Visual C++ Tools for
Cmake, and check the checkbox under the "Compilers, build tools and runtimes" section.
pip install dlib
Effective till now(2020).
pip install cmake
conda install -c conda-forge dlib
If you are using Anaconda Prompt (recommended),
conda install -c conda-forge dlib
Or you can use the approach mentioned below:
After spending a lot of time, this comment gave me the right result.
https://github.com/ageitgey/face_recognition/issues/802#issuecomment-544232494
Download Python 3.6.8 and install, make sure you add it to PATH.
Install NumPy, scipy, matplotlib and pandas in your pc/laptop with this command in command prompt:-
pip install numpy
pip install scipy
pip install matplotlib
pip install pandas
Go to https://pypi.org/project/wheel/#files and right-click on filename wheel-0.33.6-py2.py3-none-any.whl (21.6 kB) and copy link address. Then go to your pc/laptop, open command prompt and write this command "python -m pip install" after this command space first then paste the link copied. After installing successful go to the next step.
Then go to this link, https://pypi.org/simple/dlib/ and right-click on filename "dlib-19.8.1-cp36-cp36m-win_amd64.whl" then copy link address. Then open command prompt and do the same as step 2 which is, write this command "python -m pip install" after this command space first then paste the link copied. then the dlib will be installed successfully.
After that, type python and enter, then type import dlib to check dlib is installed perfectly. you can proceed to install face recognition.py which suite for python 3.6.
As you can see many answers above, But i would like to post a quick solution which works for sure in Anaconda3. I haven't chosen Visual Studio as it consumes lot of memory.
Please follow the below steps.
Step 1:
Install windows cmake.msi and configure environment variable
Step 2:
Create a conda environment, and install cmake using the below command.
pip install cmake
Step 3:
conda install -c conda-forge dlib
Note you can find few other dlib packages, but the above one will works perfectly with this procedure.
dlib will be successfully installed.
You need to install Cmake.
dlib is an c++ libary with python bindings. It needs to be builded first. My guess is this will happen automatically once you have installed Cmake
So basically I have been searching the solution for two days.
I tried everything
Installing Cmake
Adding path
installing dlib from the links mentioned in the answers
Installing ## Heading ## numpy, scipy, matplotlib, pandas
etc etc etc
BUT THE ONLY SOLUTION THAT WORKED WAS
INSTALLING MICROSOFT VISUAL STUDIO C++
After installing MS VS C++ I ran command pip install dlib and it is working like a charm.
BEST OF LUCK
Link to download Visual Studio C++
https://visualstudio.microsoft.com/thank-you-for-downloading-visual-studio-for-cplusplus/?sku=Community&rel=16&rid=30005
You have to install cmake as the error tells you.
you can follow this instructions https://www.learnopencv.com/install-dlib-on-windows/
or directly install cmake from here https://cmake.org/download/
Once cmake is installed pip install dlib should work.
I had vstudio building tools installed whe I did my test.
Choose dlib .whl file according to your installed python version.
For example if installed python version is 3.6.7 , 64bit system or if python is 3.5.0 32 bit
then choose dlib-19.5.1-cp36-cp36m-win_amd64.whl and dlib-18.17.100-cp35-none-win32.whl respectively.
Bolded text says the python supporting version.
Download wheel file from here or copy the link address
pip install dlib-19.5.1-cp36-cp36m-win_amd64.whl
for above method .whl file shoud be in the working directory
or
Below link for python3.6 supporting dlib link, for python 3.5 u can replace with dlib 35.whl link
pip install https://files.pythonhosted.org/packages/24/ea/81e4fc5b978277899b1c1a63ff358f1f645f9369e59d9b5d9cc1d57c007c/dlib-19.5.1-cp36-cp36m-win_amd64.whl#sha256=7739535b76eb40cbcf49ba98d894894d06ee0b6e8f18a25fef2ab302fd5401c7
1.use python 3.6.9 version
2.first install cmake.
conda install -c anaconda cmake
use these command to install dlib
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Just a quick update on what has worked for me (two years later). Davis King has provided two ways to add the latest python dlib (19.17.0) to any python environment in Windows 10 for me. Note, I run several Linux configs in Oracle VirtualBox but Windows 10 is my native OS which has access to the Nvidia GPU so i need an install on Windows 10. (Cannot access the GPU - easily - through VirtualBox).
First - the easiest:
pip install dlib
and the website link: https://pypi.org/project/dlib/
And then it can be easily be build from sources. Download from https://pypi.org/simple/dlib/ and follow instructions on http://dlib.net/compile.html.
Also, just found another way to access with Visual Studio 2019 (or 2017). Use vcpkg - see link https://vcpkg.readthedocs.io/en/latest/
I built dlib 19.17 on Windows 10 with CMake and it worked fine but then I found vcpkg and now the dlib libraries are integral to the Visual Studio. I no longer need to add all the external links to C++ and the linker.The version in vcpkg is currently 19.16-1 and it is built with full CUDA support.
Hope this helps others..
You can use vcpkg to install dlib.
If you don't have vcpkg, you can get it here (Read Quick Start)
After you got vcpkg, run:
vcpkg install dlib:x64-windows
I have recently installed dlib on python 3.7.
First I have installed cmake from anaconda navigator (cmake version 3.14.0)
Next i installed visual studio 2019 and installed Desktop development with C++ .
Then I do pip install dlib and now its working
None of the answers worked for me. This is what worked
Assuming you have anaconda python 3.7 installed
1) Dowload and install cmake(make sure to check the option to add cmake to system path during installation to avoid manually doing later)
Download from this link cmake download
2) conda install -c conda-forge dlib
It is basically a two-step process:
install cmap
pip install cmap
install dlib
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
If you're trying to install dlib on Windows 10 with Visual Studio 2019, then first perform:
pip install cmake
And set it in the environment variable. After that, make sure that you have the latest version of Visual Studio SDK installed. After that, perform:
pip install dlib
I hope this solves the problem
Update/Install Visual C++
Maybe try installing/updating Visual C++. Because this is necessary for CMake to run. You can install it from here, https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&rel=15#
Installation with Wheel File
Run this:
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Installation from Internet
Install CMake from https://cmake.org/download/
Run this,
set PATH="%PATH%;C:\Program Files\CMake\bin
to add CMake to your path. You can also do this manually by Editing The Environment Variables.
3)Download the following,
https://pypi.org/project/dlib/#files.
In the specified folder in which you extracted the install files run the following,
python setup.py install.
Simple and 100% working trick
(Make sure you install cmake)
My Anaconda python ver : 3.6.8 (64 bit) | OS :Windows 10
python -m pip install https://files.pythonhosted.org/packages/0e/ce/f8a3cff33ac03a8219768f0694c5d703c8e037e6aba2e865f9bae22ed63c/dlib-19.8.1-cp36-cp36m-win_amd64.whl#sha256=794994fa2c54e7776659fddb148363a5556468a6d5d46be8dad311722d54bfcf
Install dlib in Windows
download dlib from https://github.com/davisking/dlib.git
download camke from https://cmake.org/download/
Extract cmake and configure it as Environment variable to the extracted path my it was C:\Users\admin\Downloads\cmake-3.8.1-win32-x86\cmake-3.8.1-win32-x86\bin
Now extract dlib zip file and go to dlib folder
Follow this commands
cd dlib/test
mkdir build
cd build
cmake ..
cmake --build . --config Release
Now go to Release folder which would be at dlib\test\build\Release and execute this command
dtest.exe --runall
This process takes time as cmake compiles all C++ files so stay clam.
Enjoy!!!
I'm having trouble installing a Python package on my Windows machine, and would like to install it with Christoph Gohlke's Window binaries. (Which, to my experience, alleviated much of the fuss for many other package installations). However, only .whl files are available.
http://www.lfd.uci.edu/~gohlke/pythonlibs/#jpype
But how do I install .whl files?
Notes
I've found documents on wheel, but they don't seem so staightforward in explaining how to install .whl files.
This question is a duplicate with this question, which wasn't directly answered.
I just used the following which was quite simple. First open a console then cd to where you've downloaded your file like some-package.whl and use
pip install some-package.whl
Note: if pip.exe is not recognized, you may find it in the "Scripts" directory from where python has been installed. If pip is not installed, this page can help:
How do I install pip on Windows?
Note: for clarification
If you copy the *.whl file to your local drive (ex. C:\some-dir\some-file.whl) use the following command line parameters --
pip install C:/some-dir/some-file.whl
First, make sure you have updated pip to enable wheel support:
pip install --upgrade pip
Then, to install from wheel, give it the directory where the wheel is downloaded. For example, to install package_name.whl:
pip install --use-wheel --no-index --find-links=/where/its/downloaded package_name
There are several file versions on the great Christoph Gohlke's site.
Something I have found important when installing wheels from this site is to first run this from the Python console:
import pip
print(pip.pep425tags.get_supported())
so that you know which version you should install for your computer. Picking the wrong version may fail the installing of the package (especially if you don't use the right CPython tag, for example, cp27).
I am in the same boat as the OP.
Using a Windows command prompt, from directory:
C:\Python34\Scripts>
pip install wheel
seemed to work.
Changing directory to where the whl was located, it just tells me 'pip is not recognized'. Going back to C:\Python34\Scripts>, then using the full command above to provide the 'where/its/downloaded' location, it says Requirement 'scikit_image-...-win32.whl' looks like a filename, but the filename does not exist.
So I dropped a copy of the .whl in Python34/Scripts, ran the exact same command over again (with the --find-links= still going to the other folder), and this time it worked.
There's a slight difference between accessing the .whl file in python2 and python3. In python3, you need to install wheel first and then you can access .whl files.
Python3
pip install package.whl
OR
pip install wheel
And then by using wheel
wheel unpack some-package.whl
Python2
pip install some-package.whl
You have to run pip.exe from the command prompt on my computer.
I type C:/Python27/Scripts/pip2.exe install numpy
On Windows you can't just upgrade using pip install --upgrade pip, because the pip.exe is in use and there would be an error replacing it. Instead, you should upgrade pip like this:
easy_install --upgrade pip
Then check the pip version:
pip --version
If it shows 6.x series, there is wheel support.
Only then, you can install a wheel package like this:
pip install your-package.whl
To be able to install wheel files with a simple doubleclick on them you can do one the following:
1) Run two commands in command line under administrator privileges:
assoc .whl=pythonwheel
ftype pythonwheel=cmd /c pip.exe install "%1" ^& pause
2) Alternatively, they can be copied into a wheel.bat file and executed with 'Run as administrator' checkbox in the properties.
PS pip.exe is assumed to be in the PATH.
Update:
(1) Those can be combined in one line:
assoc .whl=pythonwheel& ftype pythonwheel=cmd /c pip.exe install -U "%1" ^& pause
(2) Syntax for .bat files is slightly different:
assoc .whl=pythonwheel& ftype pythonwheel=cmd /c pip.exe install -U "%%1" ^& pause
Also its output can be made more verbose:
#assoc .whl=pythonwheel|| echo Run me with administrator rights! && pause && exit 1
#ftype pythonwheel=cmd /c pip.exe install -U "%%1" ^& pause || echo Installation error && pause && exit 1
#echo Installation successfull & pause
see my blog post for details.
In-case if you unable to install specific package directly using PIP.
You can download a specific .whl (wheel) package from - https://www.lfd.uci.edu/~gohlke/pythonlibs/
CD (Change directory) to that downloaded package and install it manually by -
pip install PACKAGENAME.whl
ex:
pip install ad3‑2.1‑cp27‑cp27m‑win32.whl
EDIT: THIS NO LONGER IS A PART OF PIP
To avoid having to download such files, you can try:
pip install --use-wheel pillow
For more information, see this.
You can install the .whl file, using pip install filename. Though to use it in this form, it should be in the same directory as your command line, otherwise specify the complete filename, along with its address like pip install C:\Some\PAth\filename.
Also make sure the .whl file is of the same platform as you are using, do a python -V to find out which version of Python you are running and if it is win32 or 64, install the correct version according to it.
The only way I managed to install NumPy was as follows:
I downloaded NumPy from here
https://pypi.python.org/pypi/numpy
This Module
https://pypi.python.org/packages/d7/3c/d8b473b517062cc700575889d79e7444c9b54c6072a22189d1831d2fbbce/numpy-1.11.2-cp35-none-win32.whl#md5=e485e06907826af5e1fc88608d0629a2
Command execution from Python's installation path in PowerShell
PS C:\Program Files (x86)\Python35-32> .\python -m pip install C:/Users/MyUsername/Documents/Programs/Python/numpy-1.11.2-cp35-none-win32.whl
Processing c:\users\MyUsername\documents\programs\numpy-1.11.2-cp35-none-win32.whl
Installing collected packages: numpy
Successfully installed numpy-1.11.2
PS C:\Program Files (x86)\Python35-32>
PS.: I installed it on Windows 10.
New Python users on Windows often forget to add Python's \Scripts directory to the PATH variable during the installation. I recommend to use the Python launcher and execute pip as a script with the -m switch. Then you can install the wheels for a specific Python version (if more than one are installed) and the Scripts directory doesn't have to be in the PATH. So open the command line, navigate (with the cd command) to the folder where the .whl file is located and enter:
py -3.6 -m pip install your_whl_file.whl
Replace 3.6 by your Python version or just enter -3 if the desired Python version appears first in the PATH. And with an active virtual environment: py -m pip install your_whl_file.whl.
Of course you can also install packages from PyPI in this way, e.g.
py -3.6 -m pip install pygame
I would be suggesting you the exact way how to install .whl file.
Initially I faced many issues but then I solved it, Here is my trick to install .whl files.
Follow The Steps properly in order to get a module imported
Make sure your .whl file is kept in the python 2.7/3.6/3.7/.. folder.
Initially when you download the .whl file the file is kept in downloaded folder, my
suggestion is to change the folder. It makes it easier to install the file.
Open command prompt and open the folder where you have kept the file by entering
cd c:\python 3.7
3.Now, enter the command written below
>py -3.7(version name) -m pip install (file name).whl
Click enter and make sure you enter the version you are currently using with correct
file name.
Once you press enter, wait for few minutes and the file will be installed and you will
be able to import the particular module.
In order to check if the module is installed successfully, import the module in idle
and check it.
Thank you:)
On the MacOS, with pip installed via MacPorts into the MacPorts python2.7, I had to use #Dunes solution:
sudo python -m pip install some-package.whl
Where python was replaced by the MacPorts python in my case, which is python2.7 or python3.5 for me.
The -m option is "Run library module as script" according to the manpage.
(I had previously run sudo port install py27-pip py27-wheel to install pip and wheel into my python 2.7 installation first.)
What I did was first updating the pip by using the command:
pip install --upgrade pip and then I also installed wheel by using command: pip install wheel and then it worked perfectly Fine.
Hope it works for you I guess.
Download the package (.whl).
Put the file inside the script folder of python directory
C:\Python36\Scripts
Use the command prompt to install the package.
C:\Python36\Scripts>pip install package_name.whl
Theoretically:
Because wheel is a built distribution spec ie, no dependency on a build system and because it's a ZIP-format archive, it just has to be unpacked to the target location in-order to be used.
While pip install *.wheel adds extra features, we can also unzip (using a standard archive tool eg: 7zip) the .whl file into site-packages directory to use the package.
https://packaging.python.org/specifications/binary-distribution-format/
After installing OpenSSL, downloading the pre-built Swig executable, and ensuring the openssl libraries are located in the default c:\pkg, pip install m2crypto results in:
...
C:\Program Files (x86)\gfortran\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Pyth
on27\include -IC:\Python27\PC -Ic:\pkg\include -Ic:\users\evbo\appdata\local\tem
p\pip_build_evbo\m2crypto\SWIG -c SWIG/_m2crypto_wrap.c -o build\temp.win32-2.7\
Release\swig\_m2crypto_wrap.o -DTHREADING
gcc: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
It seems the binary installer solution for M2crypto is no longer available and I don't see any mistakes I've made based on the M2crypto install doc.
How might I resolve this install issue? Is there a dependency on older versions of GCC?
I got lucky - there's an unofficial binary installer in lieu of chandlerproject.org/bin/view/Projects/MeTooCrypto being down:
https://github.com/saltstack/salt-windows-install/blob/master/deps/win32-py2.7/M2Crypto-0.21.1.win32-py2.7.msi
This answer is based on the GitHub comment at https://github.com/iOSForensics/pymobiledevice/issues/25#issuecomment-576119104, for a Python module that requires m2crypto.
Some builds for m2crypto for specific versions of Python are available from their CI: https://ci.appveyor.com/project/m2crypto/m2crypto/history. Try selecting a version, selecting a job that matches your Python version, then going to the "Artifacts" tab and downloading an installer. To install a .whl file, see step 11 of my build tutorial below.
M2Crypto-0.35.2.win-amd64-py3.8.zip is the m2crypto module that I have built on Windows 10 x64, Python 3.8.1. It should work on any x64-based version of Windows with any version of Python 3.8.X.
However, if you are unable to find a build that matches your Python version and system type and architecture, you may need to manually build m2crypto. I adapted the build steps from their CI build scripts: https://gitlab.com/m2crypto/m2crypto/blob/master/appveyor.yml. I built the module by doing the following:
Install the latest Build Tools for Visual Studio 2019. See https://visualstudio.microsoft.com/downloads/ under "All Downloads" -> "Tools for Visual Studio 2019". This direct link was active as of this writing: https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
In the installer, select "C++ Build Tools", install, and reboot if necessary.
Install the latest full (not Light) OpenSSL for your architecture (Win64/Win32). Current version as of this writing is 1.1.1d. Make note of the directory to which you install OpenSSL. https://slproweb.com/products/Win32OpenSSL.html
In PowerShell, install the Chocolatey package manager. I used this command from their website: Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Install swig with Chocolatey (in PowerShell). choco install -r -y swig
Install the pywin32 dependency. Run pip install pywin32. If you have problems, try first running pip install wheel. To get pip to target a specific Python installation, try launching it using py -[version] -m pip install [module]. Note: you may need to use an elevated (administrator) PowerShell to install Python modules.
Get the latest m2crypto code. If you have git installed, run git clone https://gitlab.com/m2crypto/m2crypto. Otherwise, download and extract the code from GitLab: https://gitlab.com/m2crypto/m2crypto/-/archive/master/m2crypto-master.zip
Use cd to change into the directory m2crypto was cloned/extracted to.
Assuming python launches your desired Python interpreter version, run python setup.py build --openssl="C:\Program Files\OpenSSL-Win64" --bundledlls, replacing C:\Program Files\OpenSSL-Win64 with the directory to which you installed OpenSSL. (On some systems you can use the py launcher to specify a Python version to use, run py -h for more information.)
Generate the installable files. python.exe setup.py bdist_wheel bdist_wininst bdist_msi.
Install the module. cd into the dist directory and run pip install M2Crypto-0.35.2-cp38-cp38-win_amd64.whl, replacing the filename with the generated .whl file. If you have problems, try first running pip install wheel. To get pip to target a specific Python installation, try launching it using py -[version] -m pip install [module]. Alternatively, you can run the generated .exe or .msi installer. Note: you may need to use an elevated (administrator) PowerShell to install Python modules.
The https://gitlab.com/m2crypto/m2crypto project provides Windows builds of M2Crypto.
You can find wheels for current Python versions from their AppVeyor builds at https://ci.appveyor.com/project/m2crypto/m2crypto.
For example, to install M2Crypto 0.37.1 from https://ci.appveyor.com/project/m2crypto/m2crypto →
https://ci.appveyor.com/project/m2crypto/m2crypto/builds/37187357/job/5c56adinoe9l8kng/artifacts with pip for 64-bit Python 3.8, run:
pip install \
https://ci.appveyor.com/api/buildjobs/5c56adinoe9l8kng/artifacts/dist/M2Crypto-0.37.1-cp38-cp38-win_amd64.whl
NB! The artifacts may expire in AppVeyor, see this bug for updates.
It's late 2019 and installing M2Crypto is still a pain! After a ton of Googling, finally got it down to the steps below:
pip install wheel
pip install M2CryptoWin32
Using a fresh Python 2.7.17 32bit install on Windows 10. You might need install http://aka.ms/vcpython27 first.
I'd imagine one should use M2CryptoWin64 instead if you've installed 64-bit Python.
in windows, (python versions 3.7 | 3.8 | 3.9 | 3.10) you can download whl file from here and install it with this command:
python install M2Crypto-0.38.0-cp310-cp310-win_amd64.whl
replace current whl file name.
1~11: https://stackoverflow.com/a/59817750
12: install M2Crypto.whl and adb in one command
pip install M2Crypto-0.38.0-cp310-cp310-win_amd64.whl adb
Trying to install scikits.audiolab-0.11.0 on Mac, bit it requires libsndfile: http://www.mega-nerd.com/libsndfile/. I did install libsndfile supposedly, using libsndfile_python-1.0.0-py2.7-macosx10.5.mpkg, but the audiolab setup gives an error: libsndfile library not found. The error from the audiolab installer is below. It suggests that the location of the libsndfile can be specified in the site.cfg.
My inexperience with these type of installs are getting in the way of understanding this. Can anyone offer some advice on how to get this done?, or answer my questions below?
If the libsndfile was installed, where would it be, so I can specify the location? Else how to install it properly?
What is the site.cfg file? I see a site.cfg.bdist_wininst, and a site.cfg.win32 in the scikits.audiolab-0.11.0 folder that I downloaded.
What is meant by "specified in the site.cfg file in section [sndfile]" (see error below). Does this mean that I should replace the word "sndfile" with the /path/to/libsndfile between the brackets?
By the way, I checked in my /usr/lib dir and there is no libsndfile. I take it that there is where the audiolab setup will look for the file, by default.
Thanks for reading, and any help.
Error from audiolab installer:
numpy.distutils.system_info.NotFoundError: sndfile (http://www.mega-nerd.com/libsndfile/) library not found.
Directories to search for the libraries can be specified in the
site.cfg file, in section [sndfile].
libsndfile_python sounds like a binding to libsndfile rather than libsndfile itself. You probably do not have libsndfile installed. It should, however, be quite easy to install if you already have the developer tools installed:
First, download the latest source.
Unpack it somewhere.
Open Terminal and cd to the directory you unpacked.
Configure it: ./configure
Build it: make -j8
Install it (requires administrative rights): sudo make -j8 install
You can then delete the directory you unpacked, but you may want to keep it for easy uninstallation.
To install libdsnd in a mac (Tested in a Yosemite 10.10.3):
1- Install Homebrew (paste this on a terminal):
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2- Install libsnd:
brew install libsndfile
3- Link libsnd:
brew link --overwrite libsndfile
4- Install scikits.audiolab:
sudo easy_install scikits.audiolab
There you go!
For windows users:
Download file :
"scikits.audiolab‑0.11.0‑cp27‑cp27m‑win32.whl"
from "https://www.lfd.uci.edu/~gohlke/pythonlibs/#scikits.audiolab"
Install it using command : pip install scikits.audiolab‑0.11.0‑cp27‑cp27m‑win32.whl
install libsndfile from http://www.mega-nerd.com/libsndfile/ using setup:
http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.28-w32-setup.exe
copy "libsndfile-1.dll" from C:\Program Files (x86)\Mega-Nerd\libsndfile\bin
to folder Lib\site-packages\scikits\audiolab folder within your Python installation folder,
ex: C:\Python2711\Lib\site-packages\scikits\audiolab
For me this solved a problem.
Credits to "https://github.com/cournape/audiolab/issues/7" - "samuelgarcia"