I'm getting something like this. Can anyone please tell me how to fix this.
C:\Users\krush\Documents\ML using Python>pip install pocketsphinx
Collecting pocketsphinx
Using cached pocketsphinx-0.1.3.zip
Building wheels for collected packages: pocketsphinx
Running setup.py bdist_wheel for pocketsphinx: started
Running setup.py bdist_wheel for pocketsphinx: finished with status 'error'
Complete output from command C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\pocketsphinx\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\krush\AppData\Local\Temp\tmp3tyvnl9wpip-wheel- --python-tag cp36:
running bdist_wheel
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
error: command 'swig.exe' failed: No such file or directory
----------------------------------------
Failed building wheel for pocketsphinx
Running setup.py clean for pocketsphinx
Failed to build pocketsphinx
Installing collected packages: pocketsphinx
Running setup.py install for pocketsphinx: started
Running setup.py install for pocketsphinx: finished with status 'error'
Complete output from command C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\pocketsphinx\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\krush\AppData\Local\Temp\pip-x5mxeczy-record\install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
building 'sphinxbase._ad' extension
swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
swig.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
error: command 'swig.exe' failed: No such file or directory
----------------------------------------
Command "C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\pocketsphinx\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\krush\AppData\Local\Temp\pip-x5mxeczy-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\krush\AppData\Local\Temp\pip-build-cns2i_wb\pocketsphinx\
To fix the problem, I downloaded swig for windows at the time of writing this answer it was 3.0.12
For the latest swig windows version follow this link
Copy swig.exe to the python installation folder (for ex C:/python27)
Open the swigwin-3.0.12/Lib folder and copy all *.swg files to the C:/python27/Lib or equivalent python path
Open swigwin-3.0.12/Lib/python and copy all the files to C:/python27/Lib
Open the swigwin-3.0.12/Lib folder and copy over the typemaps folder to C:/python27/Lib
(Also make sure you have Microsoft Visual C++ Compiler for Python installed)
These steps worked for me.
conda install swig
pip install pocketsphinx
I didn't want to do all that setup other people are suggesting so I tried this and it worked.
This probably only works if you are using Anaconada though.
Instead of copying Swig files to the Python folder, you can simply add Swig`s location to the environment variables:
Press Ctrl+S
Type env and press Enter
Double click on Path
Add the path-to-Swig to the last blank line
Click OK and restart your PC
You try to install pocketsphinx with pip, that will download and compile this module. It requires some compiling tool like swig.
Another solution is to install a binary version of pocketsphinx. You can download a binary version here. You have to select the correct version with respect to your installation.
To determine which one you have to download, you can run the following commands, that will tell you which version you require and whether you run a 32 or 64 bit python interpreter.
"C:\Users\krush\Anaconda3\python.exe" --version
"C:\Users\krush\Anaconda3\python.exe" -c "import struct;print(struct.calcsize('P') * 8)"
Below are some commands that you may enter once you have downloaded the correct version
"C:\Users\krush\Anaconda3\python.exe" -m pip install pocketsphinx‑0.1.3‑cp35‑cp35m‑win32.whl
"C:\Users\krush\Anaconda3\python.exe" -m pip install pocketsphinx‑0.1.3‑cp36‑cp36m‑win_amd64.whl
I was also getting same error, while installing in ubuntu 16.04, I executed following commands:
sudo apt-get install -y python python-dev python-pip build-essential swig git libpulse-dev
sudo pip install pocketsphinx
source: pocketsphinx-python
In case you are working on anaconda navigator.
Just go to environment.
Search swig, your package will be displayed. Select the package and click on apply button.
It will also give a prompt list of other dependencies, which need to be installed with swig.
So just select all and click on apply button.
All the dependencies will be installed in your root directory of anaconda.
This worked for me, hope it helps.
There are few set of commands to resolve this. Just execute them:
sudo apt-get install -y python3 python3-dev python3-pip build-essential swig git libpulse-dev
sudo apt-get install libasound2-dev
sudo pip install pocketsphinx
what works for me is installing swing from conda and
conda install swig
if installed search where it is installed
where swig
then add that path to your environment variable
For mac users getting similar issues, there seems to be a problem with the current pip install framework. I followed this thread and used the solution linked. It doesn't seem like there will be a pip fix anytime soon.
Note you'll have to brew install swig before running the above steps - homebrew install link.
pip install pipwin
python -m pipwin install pocketsphinx
You can also use pipwin to install pocketsphinx.
For a purely pip-based fix (may or not work depending on your exact issue/system):
pip install swig
pip install pocketsphinx
pip freeze > requirements.txt
Fixed the issue simply for me. With pip freeze, you're likely to not have the issue again if cloning the project in another system (since swig will be installed just with pip install -r requirements.txt)
This is the kind of things for which it becomes REALLY worthwhile to look into using virtualenv or similar, instead of polluting (and endlessly re-configuring) your system.
I know I am late, but what worked for me was to download the pre-built wheel file and install it manually (tested on Windows. I am pretty sure it will only work on Windows).
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pocketsphinx
Just grab the right one (cp39 = python 3.9). When it finishes downloading, navigate to your downloads folder in cmd, and issue the following command:
pip install pocketsphinx-0.1.15-cp39-cp39-win_amd64.whl
NOTE: Change pocketsphinx-0.1.15-cp39-cp39-win_amd64.whl to the name of the whl file you downloaded. I grabbed this one because I use Python 3.9 64bit version.
Related
I've tried to type this command:
pip3 install --user psycopg2 psycopg2-binary
Bash answers:
ERROR: running install
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/private/var/folders/qf/kmd2_y0j2p9_10zkd5ctvm880000gn/T/pip-install-i0kg4ysj/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/qf/kmd2_y0j2p9_10zkd5ctvm880000gn/T/pip-record-lkzzuu55/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/qf/kmd2_y0j2p9_10zkd5ctvm880000gn/T/pip-install-i0kg4ysj/psycopg2/
You're not being able to install psycopg2 as the gcc compiler in your device is either outdated and not compatible to install and run it, or it does not exist.
if you just run pip install psycopg2-binary, then it will work on your development and testing environment, however it is not recommended for production.
To install psycopg2, make sure that you have gcc installed in your device by running-
gcc --version
gcc where
If it is not installed, then install it by referring to the guide here-
Installing GCC in Mac
I hope this helps. :)
after successfully installed python and pip, this command should work:
pip install psycopg2
This question already has answers here:
Error installing Turicreate on ubuntu python 3.8.2 on pip
(2 answers)
Closed 2 years ago.
Hello Last few days i am trying to run one script for creating the Modal for machine learning. but I am not able to install the Turicreate package in Pycharm editor.
I follow these steps to run the script.
Download Python 3.7 in this link:
(https://www.python.org/downloads/)
Download the Pycharm Editor(https://www.jetbrains.com/pycharm/)
After that, I set the project interpreter in latest python3.7 and trying to install turicreate but always I got error.
Collecting turicreate
Using cached https://files.pythonhosted.org/packages/db/54/167837569bcb816b3fe68f003f18d07ab9d5ac31b2b12b8f9b07b1ccc7a4/turicreate-4.2.tar.gz
Building wheels for collected packages: turicreate
Running setup.py bdist_wheel for turicreate: started
Running setup.py bdist_wheel for turicreate: finished with status 'error'
Complete output from command /Users/tikam/MLTikam1/venv/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/rh/qx_0gvzn6kzbqjvvbbh66t080000gn/T/pycharm-packaging1/turicreate/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /private/var/folders/rh/qx_0gvzn6kzbqjvvbbh66t080000gn/T/pip-wheel-qez5g2v_ --python-tag cp37:
running bdist_wheel
running build
installing to build/bdist.macosx-10.9-x86_64/wheel
running install
==================================================================================
ERROR
If you see this message, pip install did not find an available binary package
for your system. Supported platforms are:
* Linux x86_64 (including WSL on Windows 10).
* macOS 10.12+ x86_64.
* Python 2.7, 3.5, or 3.6.
Other possible causes of this error are:
* Outdated pip version (try `pip install -U pip`).
==================================================================================
Running setup.py clean for turicreate
Failed to build turicreate
Installing collected packages: turicreate
Running setup.py install for turicreate: started
Running setup.py install for turicreate: finished with status 'error'
Complete output from command /Users/tikam/MLTikam1/venv/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/rh/qx_0gvzn6kzbqjvvbbh66t080000gn/T/pycharm-packaging1/turicreate/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/rh/qx_0gvzn6kzbqjvvbbh66t080000gn/T/pip-record-kjt0p8as/install-record.txt --single-version-externally-managed --compile --install-headers /Users/tikam/MLTikam1/venv/include/site/python3.7/turicreate:
running install
==================================================================================
ERROR
If you see this message, pip install did not find an available binary package
for your system. Supported platforms are:
* Linux x86_64 (including WSL on Windows 10).
* macOS 10.12+ x86_64.
* Python 2.7, 3.5, or 3.6.
Other possible causes of this error are:
* Outdated pip version (try `pip install -U pip`).
==================================================================================
----------------------------------------
Failed building wheel for turicreate
Command "/Users/tikam/MLTikam1/venv/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/rh/qx_0gvzn6kzbqjvvbbh66t080000gn/T/pycharm-packaging1/turicreate/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /private/var/folders/rh/qx_0gvzn6kzbqjvvbbh66t080000gn/T/pip-record-kjt0p8as/install-record.txt --single-version-externally-managed --compile --install-headers /Users/tikam/MLTikam1/venv/include/site/python3.7/turicreate" failed with error code 1 in /private/var/folders/rh/qx_0gvzn6kzbqjvvbbh66t080000gn/T/pycharm-packaging1/turicreate/
Please suggest what step i need to follow to install the turicreat package.
I want to run this script:
Script **************
import turicreate as tc
data = tc.SFrame('photoLabel.sframe')
model = tc.image_classifier.create(data, target='photoLabel')
predictions = model.predict(data)
model.export_coreml('MyClassifier.mlmodel')
It is not supported Python 3.7 right now. So you have to return to the previous Python version.
brew unlink python
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb
Source:https://github.com/apple/turicreate/issues/788
Or you can create virtual env to run turicreate on
Download the Python3.6 tgz file from the official website (eg. Python-3.6.6.tgz)
Unpack it with tar -xvzf Python-3.6.6.tgz
cd Python-3.6.6
run ./configure
run make altinstall to install it
(install vs altinstall explanation here Difference in details between "make install" and "make altinstall")
You'll normally find your new python install under /usr/local/bin. Now you can create a new virtualenv specifying the python version with:
virtualenv --python=python3.6 env3.6
Get into the virtualenv running the command source env3.6/source/bin/activate.
Install turicreate with the classic pip install turicreate
source:https://github.com/tensorflow/tensorflow/issues/17022
I have windows 10 and fresh Python 3.6.1.
I was trying to install package Cmake 0.6.0 (needed for another package, atari-py) using
pip install cmake
but I'm getting an error.
I have these packages installed: pip,scikit-build, setuptools, wheel, pybdist.
I do have a foreign symbol in my account name (lesson learnt), but it works fine when installing other packages. I am not a skilled windows administrator.
Collecting cmake
Using cached cmake-0.6.0.tar.gz
Building wheels for collected packages: cmake
Running setup.py bdist_wheel for cmake: started
Running setup.py bdist_wheel for cmake: finished with status 'error'
Complete output from command C:\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Čejkis\\AppData\\Local\\Temp\\pycharm-packaging1\\cmake\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\EJKIS~1\AppData\Local\Temp\tmp3br7eri7pip-wheel- --python-tag cp36:
Traceback (most recent call last):
File "C:\Python\Python36-32\lib\site-packages\skbuild\setuptools_wrap.py", line 405, in setup
cmkr = cmaker.CMaker()
File "C:\Python\Python36-32\lib\site-packages\skbuild\cmaker.py", line 67, in __init__
"Problem with the CMake installation, aborting build.")
Problem with the CMake installation, aborting build.
----------------------------------------
Running setup.py clean for cmake
Failed to build cmake
Installing collected packages: cmake
Running setup.py install for cmake: started
Running setup.py install for cmake: finished with status 'error'
Complete output from command C:\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Čejkis\\AppData\\Local\\Temp\\pycharm-packaging1\\cmake\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\EJKIS~1\AppData\Local\Temp\pip-5ql_x35g-record\install-record.txt --single-version-externally-managed --compile:
Traceback (most recent call last):
File "C:\Python\Python36-32\lib\site-packages\skbuild\setuptools_wrap.py", line 405, in setup
cmkr = cmaker.CMaker()
File "C:\Python\Python36-32\lib\site-packages\skbuild\cmaker.py", line 67, in __init__
"Problem with the CMake installation, aborting build.")
Problem with the CMake installation, aborting build.
----------------------------------------
Failed building wheel for cmake
Command "C:\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Čejkis\\AppData\\Local\\Temp\\pycharm-packaging1\\cmake\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\EJKIS~1\AppData\Local\Temp\pip-5ql_x35g-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Čejkis\AppData\Local\Temp\pycharm-packaging1\cmake\
python -m pip install --upgrade pip
and then you can run
pip3 install cmake
This works for me on Pyhton 3.8
if the above answers of pip3 or pip install cmake don't work try
sudo apt-get install cmake
As of today, CMake wheels for python 3.6 are available and pip install cmake is expected to work.
Background
At the time of your first post, there were no wheels for python 3.6, pip was rightfully trying to build the wheel using the source distribution.
Considering that:
the project allowing to generate a CMake wheel itself depends on scikit-build and cmake
we simply repackage the existing binaries into the windows wheels
... you got the general error message Problem with the CMake installation, aborting build.
References:
http://cmake-python-distributions.readthedocs.io
http://scikit-build.readthedocs.io/
Installing atari-py on windows
Looking at the documentation and open pull requests of the corresponding project, it look like windows is not supported. See https://github.com/openai/atari-py
If you would like to help the project and improve their windows support, let me know and I could try to give you some guidance to create a pull request and simplify their build system.
Eventually I installed cmake 0.8 from a binary file from their webpage.
I originally wanted to install package atari-py that needed cmake. I downloaded that from git and in cmd with administrator rights I ran
python install setup.py
which worked.
python setup.py install
still didn't work. Unfortunately I can't give any further explanation.
I just downloaded VS Code with C++ libraries and that did the trick, I was able to install CMake. (I was on Windows 10 btw)
I'm trying to install my own Python package into a Python2.7 virtual environment on Windows, but I get
Installed c:\users\niklas\repos\ppy\engine
Error: no such option: --no-deps
----------------------------------------
Command "c:\users\niklas\repos\ppy\engine\.env2\scripts\python.exe -c "import setuptools, tokenize;__file__='C:\\Users\\niklas\\repos\\ppy\\engine\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" develop --no-deps" failed with error code 2 in C:\Users\niklas\repos\ppy\engine\
This does not happen when I do a normal installation (no -e flag). I've been checking the Pip and setuptools release notes, but it says nowhere the that a --no-deps option was removed.
I also added a print to my setup.py before setup() is called to print sys.argv which gives me
['-c', 'develop', '--no-deps']
so it must be setup() that is complaining. I also don't get this error when installing into a Python 3.5 virtual environment.
pip 9.0.1 from c:\users\niklas\repos\ppy\engine.env2\lib\site-packages (python 2.7)
setuptools 34.3.1
Edit: As it turns out, the normal installation also doesn't work but then it's the --record flag that is not recognized.
Installing node.py-script.py script to c:\users\niklas\repos\ppy\engine\.env2\Scripts
Installing node.py.exe script to c:\users\niklas\repos\ppy\engine\.env2\Scripts
Installing node.py.exe.manifest script to c:\users\niklas\repos\ppy\engine\.env2\Scripts
writing list of installed files to 'c:\users\niklas\appdata\local\temp\pip-okk7gy-record\install-record.txt'
Error: no such option: --record
I really don't want to necro this thread but after I have seen many suggestions this worked for me:
installation dir => python.exe -m pip install -U pip
I am using Python for making a script to work with some chemical structures in my PhD. I want to install openbabel libraries for python. I tried my best but I could not install it. It always gives error:
Error: SWIG failed. Is Open Babel installed?
Here is the Python Path on my PC: C:\Users\malih\AppData\Local\Programs\Python\Python36-32. Openbabel is installed at the following path C:\Program Files (x86)\OpenBabel-2.3.1.
When I run python -m pip install openbabel, it gives the following error:
C:\Users\malih>python -m pip install openbabel
Collecting openbabel
Using cached openbabel-2.4.1.tar.gz
Installing collected packages: openbabel
Running setup.py install for openbabel ... error
Complete output from command C:\Users\malih\AppData\Local\Programs\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\malih\\AppData\\Local\\Temp\\pip-build-glr82a7x\\openbabel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\malih\AppData\Local\Temp\pip-02z3p_a9-record\install-record.txt --single-version-externally-managed --compile:
running install
running build_ext
Warning: pkg-config could not be found.
Guessing Open Babel location:
- include_dirs: ['C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\include', 'C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\include', '/usr/local/include/openbabel-2.0']
- library_dirs: ['C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\libs', 'C:\\Users\\malih\\AppData\\Local\\Programs\\Python\\Python36-32\\PCbuild\\win32', '/usr/local/lib']
building '_openbabel' extension
swigging openbabel-python.i to openbabel-python_wrap.cpp
swig.exe -python -c++ -small -O -templatereduce -naturalvar -IC:\Users\malih\AppData\Local\Programs\Python\Python36-32\include -IC:\Users\malih\AppData\Local\Programs\Python\Python36-32\include -I/usr/local/include/openbabel-2.0 -o openbabel-python_wrap.cpp openbabel-python.i
Error: SWIG failed. Is Open Babel installed?
You may need to manually specify the location of Open Babel include and library directories. For example:
python setup.py build_ext -I/usr/local/include/openbabel-2.0 -L/usr/local/lib
python setup.py install
----------------------------------------
Command "C:\Users\malih\AppData\Local\Programs\Python\Python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\malih\\AppData\\Local\\Temp\\pip-build-glr82a7x\\openbabel\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\malih\AppData\Local\Temp\pip-02z3p_a9-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\malih\AppData\Local\Temp\pip-build-glr82a7x\openbabel\
I tried to follow the instructions on this page but they are purely for linux and I could not follow up them for Windows:
How do I use python-openbabel in Travis CI?
I also tried to install pkg-config from the following guide but even after that, it gives the same error:
How to install pkg config in windows?
Please help me on this as my work is based on this and I am stuck at this point. Thanks in advance for your time.
pip install is notoriously non-windows friendly. Either go to openbabel website and download + install windows binary, then download + install python binding, or use the unoffical official openbabel python windows build, then cd into the downloaded directory, and perform pip install OPENBABEL_FILE_WINDOWS.whl
I recently had do some quite a bit of work on 2D mol file -> 3D mol file translation using openbabel. Let me know how it works out for you.
--
edit: I should also add, python3.x is breakingly different to python2.x. So if anything breaks, try it with python2.x
This is somewhat old, but the problems still persist so i'll answer nonetheless.
The precompiled Windows binary (most likely) doesn't come with SWIG built-in, which in turn doesn't offer language bindings and gives you the error when installing from pip.
A workaround to this is to install a wheel from the unofficial Windows binaries website just like pandamakes answered.
However, the wheels already comes bundled with a precompiled obabel, so you really don't need to install the windows binaries version (the one that comes with the setup and all), but you have to know that if you're willing to ship a python script that uses this library, know that it will interfere with systems that do have BABEL_DIR in the environment variables, to fix this you have to include the whole openbabel directory from YourPythonDirectory/lib/site-packages/. in your script's folder.
Another important note is that some babel builds from the unofficial binaries website have a bug where they do not detect all file formats, especially the most common ones like sdf/pdb/mol2 or even smiles. The only versions i have confirmed working somewhat flawlessly so far are the openbabel‑3.1.1‑cp36‑cp36m‑win32.whl and openbabel‑3.1.1‑cp38‑cp38‑win32.whl.