Skip to content

compiling error: Error compiling Cython file #346

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

Closed
bohu615 opened this issue Jun 27, 2017 · 15 comments
Closed

compiling error: Error compiling Cython file #346

bohu615 opened this issue Jun 27, 2017 · 15 comments

Comments

@bohu615
Copy link

bohu615 commented Jun 27, 2017

Error compiling Cython file:
------------------------------------------------------------
...
import numpy as np
^
------------------------------------------------------------

/tmp/pip-JlTvBX-build/histomicstk/segmentation/label/_trace_object_boundaries_cython.pyx:1:0: 'pip-JlTvBX-build.histomicstk.segmentation.label._trace_object_boundaries_cython' is not a valid module name
histomicstk/segmentation/label/CMakeFiles/_trace_object_boundaries_cython.dir/build.make:61: recipe for target 'histomicstk/segmentation/label/_trace_object_boundaries_cython.cxx' failed
make[2]: *** [histomicstk/segmentation/label/_trace_object_boundaries_cython.cxx] Error 1
make[2]: *** Deleting file 'histomicstk/segmentation/label/_trace_object_boundaries_cython.cxx'
CMakeFiles/Makefile2:85: recipe for target 'histomicstk/segmentation/label/CMakeFiles/_trace_object_boundaries_cython.dir/all' failed
make[1]: *** [histomicstk/segmentation/label/CMakeFiles/_trace_object_boundaries_cython.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
Traceback (most recent call last):
  File "/home/msragpu/.local/lib/python2.7/site-packages/skbuild/setuptools_wrap.py", line 409, in setup
    cmkr.make(make_args, env=env)
  File "/home/msragpu/.local/lib/python2.7/site-packages/skbuild/cmaker.py", line 417, in make
    os.path.abspath(CMAKE_BUILD_DIR)))

An error occurred while building with CMake.
  Command:
    "cmake" "--build" "." "--target" "install" "--config" "Release" "--"
  Source directory:
    /tmp/pip-JlTvBX-build
  Working directory:
    /tmp/pip-JlTvBX-build/_skbuild/cmake-build
Please see CMake's output for more information.

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-JlTvBX-build/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-HC5cFs-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-JlTvBX-build/

$ which cython
~/.local/bin/cython
$ cython --version
Cython version 0.25.2

It's so painful to get the environment right... It's just numpy, cython, etc. There's no reason to make things so complicated. And I still cannot install this so long that I've tried couples of days trying to get it right. Can you help me? It seems Cython is detected and other dependences are also correctly installed.

@manthey
Copy link
Contributor

manthey commented Jun 27, 2017

@hbkunn Have you tried just using the Vagrant environment (see https://github.com/DigitalSlideArchive/HistomicsTK/blob/master/ansible/README.rst)? Usually that is the easiest way to get everything installed.

@bohu615
Copy link
Author

bohu615 commented Jun 28, 2017

@manthey still I got this error

$ sudo python deploy_docker.py start
Pulling rabbitmq:management
Creating rabbitmq:management - histomicstk_rmq
Starting rabbitmq:management - histomicstk_rmq
Pulling mongo:latest
Creating mongo:latest - histomicstk_mongodb
Starting mongo:latest - histomicstk_mongodb
Pulling dsarchive/girder_worker:v0.1.3
Creating dsarchive/girder_worker:v0.1.3 - histomicstk_girder_worker
Starting dsarchive/girder_worker:v0.1.3 - histomicstk_girder_worker
Pulling dsarchive/histomicstk_main:v0.1.3
Creating dsarchive/histomicstk_main:v0.1.3 - histomicstk_histomicstk
Starting dsarchive/histomicstk_main:v0.1.3 - histomicstk_histomicstk
Traceback (most recent call last):
File "deploy_docker.py", line 774, in
containers_start(**vars(args))
File "deploy_docker.py", line 153, in containers_start
mongo=mongo, provision=provision, **kwargs):
File "deploy_docker.py", line 224, in container_start_histomicstk
client.start(container=ctn.get('Id'))
File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 21, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/docker/api/container.py", line 383, in start
self._raise_for_status(res)
File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 174, in _raise_for_status
raise errors.APIError(e, response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("{"message":"driver failed programming external connectivity on endpoint histomicstk_histomicstk (52556e15c1e4e3c33947e362925efd8a4e630aed865671d35a0c34bc16e8b098): Error starting userland proxy: listen tcp 0.0.0.0:8080: bind: address already in use"}")

@bohu615
Copy link
Author

bohu615 commented Jun 28, 2017

@manthey I just wanna use it as a Python toolkit. Is there an alternative way to avoid messing around with Docker?

@bohu615
Copy link
Author

bohu615 commented Jun 28, 2017

https://stackoverflow.com/questions/42102656/cython-compile-error-is-not-a-valid-module-name

according to this, I delete __ init__.py then it's installed successfully.

@bohu615 bohu615 closed this as completed Jun 28, 2017
@bohu615 bohu615 reopened this Jun 28, 2017
@bohu615
Copy link
Author

bohu615 commented Jun 28, 2017

thank you very much!
It's very useful and easy to use!

@alexsavio
Copy link

I got this same issue.
I had to deactivate and then reactivate my virtualenv, to get the paths of cmake and cython correctly (the ones from my virtualenv). Then I had to clone the repository again (maybe to get rid of some cmake cache files?), remove the init.py file, and everything worked fine.

@cklat
Copy link

cklat commented Aug 27, 2018

Is this workaround still up to date? I want to try it HistomicsTK but struggling to get it running at the moment. I tried to install in editable and non-editable mode. The installation in editable mode leads to some errors with girder and the latter has problems with Cython or CMake whatsoever.

Removing the init.py file and/or re-activating my virtualenv didn't help.

@manthey
Copy link
Contributor

manthey commented Aug 27, 2018

@cklat Did you try this in the Vagrant or outside of it? Did you use girder-install to install HistomicsTK (which installs histomicstk in editable mode)?

@cklat
Copy link

cklat commented Aug 27, 2018

@manthey I tried to install it as a Python-toolkit, so not in Vagrant. I didn't use girder-install, I strictly followed the installation instructions on the doc page (https://digitalslidearchive.github.io/HistomicsTK/installation.html)

I first encountered the problem with girder for which I opened an issue in the large_image git as I assumed there was some problem with large_image and girder (see girder/large_image#300). But it turns out the installation of large_image is fine and that the installation of HistomicsTK seems to introduce conflicts between all those packages or so. Anyway, installing all the packages in editable or non-editable mode doesn't help and the workaround mentioned here doesn't help either, unfortunately.

@manthey
Copy link
Contributor

manthey commented Aug 27, 2018

Assuming that you installed large_image in non-editable mode, the instructions at https://digitalslidearchive.github.io/HistomicsTK/installation.html will work (I just tried them in a clean Ubuntu 18.04 docker).

If you see a cmake error (such as cmake not found), it is because cmake is installed via pip (if it isn't present), and gets placed at ~/.local/bin. The default ubuntu .profile bash script only adds this path to the PATH if it exists when you log in. If you create this directory, log out and log in, then it will work.

See this example: https://gist.github.com/manthey/3fd17ce76ef01243b976137570cd6628

@cklat
Copy link

cklat commented Aug 27, 2018

Yes, I installed large_image in non-editable mode but I'm still not able to get it running. Installing HistomicsTK in editable mode importing will fail because girder could not be found. Installing HistomicsTK in non-editable mode gives me an cmake-related error something about Ninja, like so: #362 (the longer error output).

If it makes any difference, I'm trying to run it on osx. I tried to install cmake via pip and via brew. No difference.

@manthey
Copy link
Contributor

manthey commented Aug 28, 2018

I'm actually familiar with how things get installed on osx. Do you have a ~/.local/bin directory and is in your path? If not, can you create such a directory and then add it to your path. After doing so, does installing HistomicsTK in editable mode work?

@cklat
Copy link

cklat commented Aug 28, 2018

No, I didn't have a ~/.local/bin directory. I tried to create one and add it to PATH. Re-Installed histomicstk in editable mode but still no success. Gives me an ModuleNotFoundError: No module named 'girder' error. Re-Installing it in non-editable mode results again in a cmake-related error, like before.

I also tried to give it try from beginning with a clean virtual env, that is installing openslide, then large_image and then again histomicstk. Still, no changes. In fact, nothing gets placed into the ~/.local/bin directory during any of those installations

@manthey
Copy link
Contributor

manthey commented Aug 30, 2018

I'm not familiar enough with OSX to help further. I think if you installed cmake and its dependencies, it would work. We have relatively short term plans to make HistomicsTK directly pip installable. If you can't get it working, can you use a docker deployment?

@cklat
Copy link

cklat commented Sep 3, 2018

A colleague of mine reported similar error outputs on his windows machine, also something about girder is missing and other. He cannot get it run either, unfortunately.

I haven't worked with docker yet, so I'm not sure if I know how to use it and can give you a reasonable feedback.

If you are planning to release it via pip the next couple days (maybe weeks), I will definitely try it then.

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

4 participants