AndrewWalker / pydubins

Python wrapper of the C version of the Dubins-Curves library
MIT License
72 stars 54 forks source link

Building wheel for dubins (setup.py) ... error #16

Open fzdm2005 opened 3 years ago

fzdm2005 commented 3 years ago

C:\Users\Administrator>pip install C:\dubins-1.0.1.tar Processing c:\dubins-1.0.1.tar Building wheels for collected packages: dubins Building wheel for dubins (setup.py) ... error ERROR: Command errored out with exit status 1: command: 'c:\users\administrator\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-skffgh_w\setup.py'"'"'; file='"'"'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-skffgh_w\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\Administrator\AppData\Local\Temp\pip-wheel-uy59qlsk' cwd: C:\Users\Administrator\AppData\Local\Temp\pip-req-build-skffgh_w\ Complete output (16 lines): running bdist_wheel running build running build_ext skipping 'dubins\dubins.c' Cython extension (up-to-date) building 'dubins' extension creating build creating build\temp.win-amd64-3.7 creating build\temp.win-amd64-3.7\Release creating build\temp.win-amd64-3.7\Release\dubins creating build\temp.win-amd64-3.7\Release\dubins\src C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Idubins/include -Ic:\users\administrator\appdata\local\programs\python\python37\include -Ic:\users\administrator\appdata\local\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcdubins/src/dubins.c /Fobuild\temp.win-amd64-3.7\Release\dubins/src/dubins.obj dubins.c dubins/src/dubins.c(76): error C2065: “M_PI”: 未声明的标识符 dubins/src/dubins.c(385): error C2065: “M_PI”: 未声明的标识符 dubins/src/dubins.c(400): error C2065: “M_PI”: 未声明的标识符 error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Failed building wheel for dubins Running setup.py clean for dubins Failed to build dubins Installing collected packages: dubins Running setup.py install for dubins ... error ERROR: Command errored out with exit status 1: command: 'c:\users\administrator\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-skffgh_w\setup.py'"'"'; file='"'"'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-skffgh_w\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\Administrator\AppData\Local\Temp\pip-record-d30bjoao\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\administrator\appdata\local\programs\python\python37\Include\dubins' cwd: C:\Users\Administrator\AppData\Local\Temp\pip-req-build-skffgh_w\ Complete output (16 lines): running install running build running build_ext skipping 'dubins\dubins.c' Cython extension (up-to-date) building 'dubins' extension creating build creating build\temp.win-amd64-3.7 creating build\temp.win-amd64-3.7\Release creating build\temp.win-amd64-3.7\Release\dubins creating build\temp.win-amd64-3.7\Release\dubins\src C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -Idubins/include -Ic:\users\administrator\appdata\local\programs\python\python37\include -Ic:\users\administrator\appdata\local\programs\python\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcdubins/src/dubins.c /Fobuild\temp.win-amd64-3.7\Release\dubins/src/dubins.obj dubins.c dubins/src/dubins.c(76): error C2065: “M_PI”: undeclared identifier dubins/src/dubins.c(385): error C2065: “M_PI”: undeclared identifier dubins/src/dubins.c(400): error C2065: “M_PI”: undeclared identifier error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Command errored out with exit status 1: 'c:\users\administrator\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-skffgh_w\setup.py'"'"'; file='"'"'C:\Users\Administrator\AppData\Local\Temp\pip-req-build-skffgh_w\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\Administrator\AppData\Local\Temp\pip-record-d30bjoao\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\administrator\appdata\local\programs\python\python37\Include\dubins' Check the logs for full command output.

rallen10 commented 2 years ago

@fzdm2005 did you ever get a resolution for this? I just ran into the same problem

Edit: nevermind, it seems that my error was slightly different but also occurred when trying to pip install dubins. My error ended up being:

 dubins/dubins.c: In function ‘PyInit_dubins’:
    dubins/dubins.c:4497:34: error: ‘PyTypeObject {aka struct _typeobject}’ has no member named ‘tp_print’; did you mean ‘tp_dict’?
       __pyx_type_6dubins__DubinsPath.tp_print = 0;
                                      ^~~~~~~~
                                      tp_dict
    dubins/dubins.c:4502:54: error: ‘PyTypeObject {aka struct _typeobject}’ has no member named ‘tp_print’; did you mean ‘tp_dict’?
       __pyx_type_6dubins___pyx_scope_struct__sample_many.tp_print = 0;
                                                          ^~~~~~~~
                                                          tp_dict

To workaround my error, I downgraded my python from 3.9 to 3.8. Related thread here: https://bugzilla.redhat.com/show_bug.cgi?id=1791745

rdesc commented 2 years ago

An alternative solution is to install the package from source if you want to avoid downgrading python, i.e.

  1. clone - git clone https://github.com/AndrewWalker/pydubins
  2. remove the cython generated dubins.c file - rm dubins/dubins.c
  3. build - python setup.py build_ext --inplace
  4. Install with pip - pip install .
nivolog commented 1 year ago

@rdesc Hello! How to use package after I installed it using your instrcutions? Simple "import dubins" don't work

Edit: Just figured it out. All you need is to append your path to dubins package

import sys
sys.path.append("###path to dubins package###")
import dubins
rdesc commented 1 year ago

As an update. I tried to make this work with python 3.9 and came across the following error

Error compiling Cython file:
------------------------------------------------------------
...
        ts = []
        def f(q, t):
            qs.append(q)
            ts.append(t)
            return 0
        core.dubins_path_sample_many(self.ppth, step_size, callback, <void*>f)
                                                           ^
------------------------------------------------------------

dubins/dubins.pyx:123:59: Cannot assign type 'int (double *, double, void *) except? -1' to 'DubinsPathSamplingCallback'. Exception values are incompatible. Suggest adding 'noexcept' to type 'int (double *, double, void *) except? -1'.

Simple fix is change this line https://github.com/AndrewWalker/pydubins/blob/4ee7e76b95304cbebb3a505f5f483a28403f5dc5/dubins/core.pxd#L35

To the following:

    ctypedef int (*DubinsPathSamplingCallback)(double q[3], double t, void* user_data) except? -1

And then building with cython python setup.py build_ext --inplace should work fine

rdesc commented 7 months ago

Forked the repo with a working binary for Python 3.9 https://github.com/rdesc/pydubins

Should be able to install with 1 command now

pip install git+https://github.com/rdesc/pydubins.git
kostaskonkk commented 6 months ago

I have tested the fork of @rdesc and it works also with python3.10 and python3.11. I have not tested python3.12

@AndrewWalker would it be a good idea to merge @rdesc fork into this repo so newer python versions are supported?

rdesc commented 6 months ago

Oh nice, thats good to hear! I'll update the readme on the fork. I don't think the owner of this repo is responsive.

Chuanlong-Zang commented 5 months ago

@rdesc Thanks for your fork! It works for me using Python 3.10. Is it possible to publish the new package to pip somehow?

rdesc commented 5 months ago

Great! Hmm that's a good idea actually. Then we could even merge some of the other fixes people have found. Maybe we could call it dubins2 or something.

CAI006 commented 3 months ago

image a little weird

rdesc commented 3 months ago

@CAI006 hmm I haven't tried this in Windows but it seems like the error is coming from Microsoft visual studio from the screenshot ?

rdesc commented 3 months ago

@CAI006 also, take a look here https://github.com/AndrewWalker/pydubins/pull/14