Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Error: Cannot open source file: 'fastxml/splitter.cpp': No such file or directory #13

Closed
nishkalavallabhi opened this issue Aug 3, 2018 · 5 comments

Comments

@nishkalavallabhi
Copy link

I am trying to run the setup.py and I am running into the following error:
I am on Windows10. Any idea how to work with this?


building 'fastxml.splitter' extension
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\svajjala\Python36\include -IC:\Users\svajjala\Python36\include -IC:\Users\svajjala\Python36\lib\site-packages\numpy\core\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\cppwinrt" /EHsc /Tpfastxml/splitter.cpp /Fobuild\temp.win-amd64-3.6\Release\fastxml/splitter.obj -O3 -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-O3'
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
splitter.cpp
c1xx: fatal error C1083: Cannot open source file: 'fastxml/splitter.cpp': No such file or directory
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe' failed with exit status 2


@nishkalavallabhi
Copy link
Author

Okay, I did not realize it is written for Python 2+. One of the comments mentioned compatibility with Python 3. I changed a few print statements the errors showed, and one import statement, and switched to Linux. Installation now went smoothly. I will get back if I run into further problems.

@Refefer
Copy link
Owner

Refefer commented Aug 3, 2018

It looks like the actual error is that Visual Studio doesn't support -O3 as a compilation flag.

Can you open up setup.py and remove '-O3' from the compile_args and try compiling again?

@nishkalavallabhi
Copy link
Author

It is a python 2.7-3 issue. I fixed syntactic issues in trainer.py and the training process ran without problems even from visual studio. The model was saved. However, I seem to be having trouble with the inferencer now (and I don't know how to edit it as it is a Cython/Pyx file.) Here is the error:


clf = Inferencer("generated_files\\myfastxml.model")

File "C:\Users\svajjala\Python36\lib\site-packages\fastxml\fastxml.py", line 21, in init
forest = IForest(dname, self.n_trees, self.n_labels)
File "fastxml\inferencer.pyx", line 251, in fastxml.inferencer.IForest.init
File "fastxml\inferencer.pyx", line 290, in fastxml.inferencer.ITree.init
File "fastxml\inferencer.pyx", line 138, in fastxml.inferencer.load_dense_f32
File "fastxml\inferencer.pyx", line 140, in fastxml.inferencer.load_dense_f32
File "fastxml\inferencer.pyx", line 112, in fastxml.inferencer.read_row
TypeError: a bytes-like object is required, not 'str'

@Refefer
Copy link
Owner

Refefer commented Aug 7, 2018

Great debugging, I hope you'll submit a PR when done :)

One of the changes between Python 2 and Python 3 is the way 'bytes' are represented inside python. In inferencer.pyx, it's reading in data as a str instead of bytes, which it appears the struct object needs.

If you'd PR your current work, I'll see if I can get it working on python 3 tonight.

@nishkalavallabhi
Copy link
Author

nishkalavallabhi commented Aug 8, 2018

Okay, while attempting to submit a pull request, I spent a lot of time last night trying to understand why my version and the code on github are different. I finally realized the version I am using is the one installed via pip. That perhaps is still in 2.7!

Now, I cloned this repo, and both on Windows and Linux, I see a lot of warnings while installation using setup.py and in the end, when I use the installation to load the module, it shows me:


from .inferencer import IForest, LeafComputer, Blender, IForestBlender
ModuleNotFoundError: No module named 'fastxml.inferencer'


Like I said, installing via pip works, but with Python 2.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants