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

issue with installing. #60

Closed
ranok92 opened this issue Apr 1, 2018 · 8 comments
Closed

issue with installing. #60

ranok92 opened this issue Apr 1, 2018 · 8 comments

Comments

@ranok92
Copy link

ranok92 commented Apr 1, 2018

Hey, I tried to install the package. It installed properly. But when I tried to actually use it in python, this is what I am getting. Any idea why? I am using python 2.7. Also, I ran the setup.py file manually : python setup.py build_ext --inplace and I am using windows if that matters.

warning: pydensecrf\densecrf.pyx:20:4: Unreachable code

Error compiling Cython file:
------------------------------------------------------------
...
cimport eigen


cdef LabelCompatibility* _labelcomp(compat) except NULL:
    if isinstance(compat, Number):
        return new PottsCompatibility(compat)
                  ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:13:19: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...

cdef LabelCompatibility* _labelcomp(compat) except NULL:
    if isinstance(compat, Number):
        return new PottsCompatibility(compat)
    elif memoryview(compat).ndim == 1:
        return new DiagonalCompatibility(eigen.c_vectorXf(compat))
                  ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:15:19: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...
    if isinstance(compat, Number):
        return new PottsCompatibility(compat)
    elif memoryview(compat).ndim == 1:
        return new DiagonalCompatibility(eigen.c_vectorXf(compat))
    elif memoryview(compat).ndim == 2:
        return new MatrixCompatibility(eigen.c_matrixXf(compat))
                  ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:17:19: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...
        return ptr

    # It might already be deleted by the library, actually.
    # Yeah, pretty sure it is.
    def __dealloc__(self):
        del self.thisptr
       ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:36:8: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...
        del self.thisptr


cdef class ConstUnary(Unary):
    def __cinit__(self, float[:,::1] u not None):
        self.thisptr = new ConstUnaryEnergy(eigen.c_matrixXf(u))
                          ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:41:27: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...
        self.thisptr = new ConstUnaryEnergy(eigen.c_matrixXf(u))


cdef class LogisticUnary(Unary):
    def __cinit__(self, float[:,::1] L not None, float[:,::1] f not None):
        self.thisptr = new LogisticUnaryEnergy(eigen.c_matrixXf(L), eigen.c_matrixXf(f))
                          ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:46:27: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...
        # will always be called with the same params as the subclass, automatically.

        # We also only want to avoid creating an object if we're just being called
        # from a subclass as part of the hierarchy.
        if type(self) is DenseCRF:
            self._this = new c_DenseCRF(nvar, nlabels)
                            ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:58:29: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...

    def __dealloc__(self):
        # Because destructors are virtual, this is enough to delete any object
        # of child classes too.
        if self._this:
            del self._this
           ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:69:12: Operation only allowed in c++

Error compiling Cython file:
------------------------------------------------------------
...
cdef class DenseCRF2D(DenseCRF):

    # The same comments as in the superclass' `__cinit__` apply here.
    def __cinit__(self, int w, int h, int nlabels, *_, **__):
        if type(self) is DenseCRF2D:
            self._this = self._this2d = new c_DenseCRF2D(w, h, nlabels)
                                           ^
------------------------------------------------------------

pydensecrf\densecrf.pyx:109:44: Operation only allowed in c++
Traceback (most recent call last):

  File "<ipython-input-6-5cbb70704c71>", line 1, in <module>
    runfile('C:/Users/konar/ECSE DEEPMEDIC/pydensecrf/densecrf3d.py', wdir='C:/Users/konar/ECSE DEEPMEDIC/pydensecrf')

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\spyder\utils\site\sitecustomize.py", line 87, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "C:/Users/konar/ECSE DEEPMEDIC/pydensecrf/densecrf3d.py", line 7, in <module>
    import pydensecrf.densecrf as dcrf

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\pyximport\pyximport.py", line 458, in load_module
    language_level=self.language_level)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\pyximport\pyximport.py", line 233, in load_module
    exec("raise exc, None, tb", {'exc': exc, 'tb': tb})

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\pyximport\pyximport.py", line 215, in load_module
    inplace=build_inplace, language_level=language_level)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\pyximport\pyximport.py", line 191, in build_module
    reload_support=pyxargs.reload_support)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\pyximport\pyxbuild.py", line 102, in pyx_to_dll
    dist.run_commands()

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\distutils\dist.py", line 953, in run_commands
    self.run_command(cmd)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\distutils\dist.py", line 972, in run_command
    cmd_obj.run()

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\distutils\command\build_ext.py", line 340, in run
    self.build_extensions()

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\site-packages\Cython\Distutils\old_build_ext.py", line 194, in build_extensions
    self.build_extension(ext)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\distutils\command\build_ext.py", line 499, in build_extension
    depends=ext.depends)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\distutils\msvc9compiler.py", line 473, in compile
    self.initialize()

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\distutils\msvc9compiler.py", line 383, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)

  File "C:\Users\konar\Anaconda3\envs\py27theano\lib\distutils\msvc9compiler.py", line 271, in query_vcvarsall
    raise DistutilsPlatformError("Unable to find vcvarsall.bat")

ImportError: Building module pydensecrf.densecrf failed: ['DistutilsPlatformError: Unable to find vcvarsall.bat\n']

Thanks,
Abhisek

@lucasb-eyer
Copy link
Owner

Why did you decide to run python setup.py build_ext --inplace instead of just pip install .?

For some reason, it is trying to compile as C, not C++. When googling your error, I found people reporting it when they were using too old setuptools.

I'm afraid I cannot really help you any more as I'm not on Windows, but I'd definitely try installing it with pip.

PS: I edited your message to format it correctly by surrounding the output snippet by three backticks (````), please do so yourself in the future, your issue was completely unreadable!

@ranok92
Copy link
Author

ranok92 commented Apr 1, 2018 via email

@lucasb-eyer
Copy link
Owner

lucasb-eyer commented Apr 1, 2018

I have fixed the round issue as it was already reported in #44, seems to be a windows problem. I have also updated the version on PyPI, so you can try installing the latest version (1.0r3) again as pip install pydensecrf and see if it works.

If it still doesn't work, you can re-open this issue, although I will not have any new ideas to help you, I'm afraid!

@ranok92
Copy link
Author

ranok92 commented Apr 2, 2018 via email

@ranok92
Copy link
Author

ranok92 commented Apr 2, 2018 via email

@ranok92
Copy link
Author

ranok92 commented Apr 2, 2018 via email

@lucasb-eyer
Copy link
Owner

Please keep issues on-topic and open a new issue for new problems.

Regarding your last question, please read the README file more carefully, there is a section about non-2D (and N-D) use.

@ranok92
Copy link
Author

ranok92 commented Apr 2, 2018 via email

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

No branches or pull requests

2 participants