I try to install Box2D on python but I get the error log:
C:\>pip3 install Box2D
Collecting Box2D
Using cached https://files.pythonhosted.org/packages/cc/7b/ddb96fea1fa5b24f8929714ef483f64c33e9649e7aae066e5f5023ea426a/Box2D-2.3.2.tar.gz
Building wheels for collected packages: Box2D
Running setup.py bdist_wheel for Box2D ... error
Complete output from command c:\users\hp-laptop\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\HP-LAP~1\\AppData\\Local\\Temp\\pip-install-r48_7g5v\\Box2D\\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\HP-LAP~1\AppData\Local\Temp\pip-wheel-d2ghuwrx --python-tag cp36:
Using setuptools (version 40.5.0).
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\Box2D
copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.6\Box2D
copying library\Box2D\__init__.py -> build\lib.win-amd64-3.6\Box2D
creating build\lib.win-amd64-3.6\Box2D\b2
copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.6\Box2D\b2
running build_ext
building 'Box2D._Box2D' extension
swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
C:\Users\HP-Laptop\AppData\Local\Programs\Python\Python36\swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
C:\Users\HP-Laptop\AppData\Local\Programs\Python\Python36\Lib\pyprimtypes.swg(7) : Error: Syntax error in input(1).
error: command 'C:\\Users\\HP-Laptop\\AppData\\Local\\Programs\\Python\\Python36\\swig.exe' failed with exit status 1
----------------------------------------
Failed building wheel for Box2D
Running setup.py clean for Box2D
Failed to build Box2D
Installing collected packages: Box2D
Running setup.py install for Box2D ... error
Complete output from command c:\users\hp-laptop\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\HP-LAP~1\\AppData\\Local\\Temp\\pip-install-r48_7g5v\\Box2D\\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\HP-LAP~1\AppData\Local\Temp\pip-record-nv5dm4ru\install-record.txt --single-version-externally-managed --compile:
Using setuptools (version 40.5.0).
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\Box2D
copying library\Box2D\Box2D.py -> build\lib.win-amd64-3.6\Box2D
copying library\Box2D\__init__.py -> build\lib.win-amd64-3.6\Box2D
creating build\lib.win-amd64-3.6\Box2D\b2
copying library\Box2D\b2\__init__.py -> build\lib.win-amd64-3.6\Box2D\b2
running build_ext
building 'Box2D._Box2D' extension
swigging Box2D\Box2D.i to Box2D\Box2D_wrap.cpp
C:\Users\HP-Laptop\AppData\Local\Programs\Python\Python36\swig.exe -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library\Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D\Box2D_wrap.cpp Box2D\Box2D.i
C:\Users\HP-Laptop\AppData\Local\Programs\Python\Python36\Lib\pyprimtypes.swg(7) : Error: Syntax error in input(1).
error: command 'C:\\Users\\HP-Laptop\\AppData\\Local\\Programs\\Python\\Python36\\swig.exe' failed with exit status 1
----------------------------------------
Command "c:\users\hp-laptop\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\HP-LAP~1\\AppData\\Local\\Temp\\pip-install-r48_7g5v\\Box2D\\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\HP-LAP~1\AppData\Local\Temp\pip-record-nv5dm4ru\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\HP-LAP~1\AppData\Local\Temp\pip-install-r48_7g5v\Box2D\
I tried all solutions for windows from Installing pocketsphinx python module: command 'swig.exe' failed without result.
How can I install Box2D and what means error code 1 by swig ?
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 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)
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.
Open the swigwin-3.0.12/Lib folder and copy all *.swg files to the C:/python27/Lib or equivalent python path 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.
Fix: ‘Command “python setup.py egg_info” failed with error code 1’ When Installing Python. The error code 1 is defined as Operation not permitted in python standard errno system symbols. This issue is mostly caused when your setuptools do not appear to be installed or updated.
Hello there I must be late but I hope this helps someone to solve his problem.
Just use any package manager like choco
or conda
or any other package manager to install the swig
package to your machine then run the command to install box2d again.
choco install swig
pip install box2d-py
I got the same error for Box2D, but solved as follows.
I am using Anaconda environment with python3.6.
try these.
conda install swig
pip install box2d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With