lucasb-eyer / pydensecrf

Python wrapper to Philipp Krähenbühl's dense (fully connected) CRFs with gaussian edge potentials.
MIT License
1.93k stars 411 forks source link

Installing on win10 64bit python3.7 #89

Closed ezrabest closed 3 years ago

ezrabest commented 5 years ago

I have tried all solutions suggested in other issues, but the installation failed, with pip and with .git commands. I'm running on win10 64bit python 3.7 all installation tools were updated. the error message: `(base) C:\Users\Ezra>pip install git+https://github.com/lucasb-eyer/pydensecrf.git Collecting git+https://github.com/lucasb-eyer/pydensecrf.git Cloning https://github.com/lucasb-eyer/pydensecrf.git to c:\users\ezra\appdata\local\temp\pip-req-build-2k6r0wk2 Running command git clone -q https://github.com/lucasb-eyer/pydensecrf.git 'C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2' Building wheels for collected packages: pydensecrf Building wheel for pydensecrf (setup.py) ... error ERROR: Complete output from command 'c:\users\ezra\appdata\local\continuum\anaconda3\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\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\Ezra\AppData\Local\Temp\pip-wheel-6plwp_tx' --python-tag cp37: ERROR: running bdist_wheel running build running build_py creating build creating build\lib.win-amd64-3.7 creating build\lib.win-amd64-3.7\pydensecrf copying pydensecrf\utils.py -> build\lib.win-amd64-3.7\pydensecrf copying pydensecrf__init__.py -> build\lib.win-amd64-3.7\pydensecrf running build_ext building 'pydensecrf.eigen' extension creating build\temp.win-amd64-3.7 creating build\temp.win-amd64-3.7\Release creating build\temp.win-amd64-3.7\Release\pydensecrf C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ipydensecrf/densecrf/include -Ipydensecrf -Ic:\users\ezra\appdata\local\continuum\anaconda3\include -Ic:\users\ezra\appdata\local\continuum\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tppydensecrf/eigen.cpp /Fobuild\temp.win-amd64-3.7\Release\pydensecrf/eigen.obj eigen.cpp C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(120): error C2373: 'Eigen::DenseBase::segment': redefinition; different type modifiers C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/DenseBase.h(291): note: see declaration of 'Eigen::DenseBase::segment' C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(121): error C2447: '{': missing function header (old-style formal list?) C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(152): error C2373: 'Eigen::DenseBase::head': redefinition; different type modifiers C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/DenseBase.h(294): note: see declaration of 'Eigen::DenseBase::head' C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(153): error C2447: '{': missing function header (old-style formal list?) C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(184): error C2373: 'Eigen::DenseBase::tail': redefinition; different type modifiers C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/DenseBase.h(297): note: see declaration of 'Eigen::DenseBase::tail' C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(185): error C2447: '{': missing function header (old-style formal list?) error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Failed building wheel for pydensecrf Running setup.py clean for pydensecrf Failed to build pydensecrf Installing collected packages: pydensecrf Running setup.py install for pydensecrf ... error ERROR: Complete output from command 'c:\users\ezra\appdata\local\continuum\anaconda3\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\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\Ezra\AppData\Local\Temp\pip-record-j4m6iof8\install-record.txt' --single-version-externally-managed --compile: ERROR: running install running build running build_py creating build creating build\lib.win-amd64-3.7 creating build\lib.win-amd64-3.7\pydensecrf copying pydensecrf\utils.py -> build\lib.win-amd64-3.7\pydensecrf copying pydensecrf__init__.py -> build\lib.win-amd64-3.7\pydensecrf running build_ext building 'pydensecrf.eigen' extension creating build\temp.win-amd64-3.7 creating build\temp.win-amd64-3.7\Release creating build\temp.win-amd64-3.7\Release\pydensecrf C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ipydensecrf/densecrf/include -Ipydensecrf -Ic:\users\ezra\appdata\local\continuum\anaconda3\include -Ic:\users\ezra\appdata\local\continuum\anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /EHsc /Tppydensecrf/eigen.cpp /Fobuild\temp.win-amd64-3.7\Release\pydensecrf/eigen.obj eigen.cpp C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(120): error C2373: 'Eigen::DenseBase::segment': redefinition; different type modifiers C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/DenseBase.h(291): note: see declaration of 'Eigen::DenseBase::segment' C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(121): error C2447: '{': missing function header (old-style formal list?) C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(152): error C2373: 'Eigen::DenseBase::head': redefinition; different type modifiers C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/DenseBase.h(294): note: see declaration of 'Eigen::DenseBase::head' C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(153): error C2447: '{': missing function header (old-style formal list?) C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(184): error C2373: 'Eigen::DenseBase::tail': redefinition; different type modifiers C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/DenseBase.h(297): note: see declaration of 'Eigen::DenseBase::tail' C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\pydensecrf\densecrf\include\Eigen\src/Core/VectorBlock.h(185): error C2447: '{': missing function header (old-style formal list?) error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\bin\HostX86\x64\cl.exe' failed with exit status 2

ERROR: Command "'c:\users\ezra\appdata\local\continuum\anaconda3\python.exe' -u -c 'import setuptools, tokenize;file='"'"'C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2\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\Ezra\AppData\Local\Temp\pip-record-j4m6iof8\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Ezra\AppData\Local\Temp\pip-req-build-2k6r0wk2`

thanks for your assist

kimisecond commented 5 years ago

https://www.lfd.uci.edu/~gohlke/pythonlibs/#pydensecrf Using a whl prebuilt by LFD, UCI seemed to solve this issue.

However, installation in linux (e.g Ubuntu) still encounters a similar problem (using gcc).

Might be a specific problem installing with python 3.7, for it is fine to install with Python 3.6.

david-littlefield commented 3 years ago

In addition to @kimisecond's answer, to install "whl" file:

pip install pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl

*Change file name to whichever one you download.

tamireiny commented 3 years ago

@thealtruist Can you please give a direct link to pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl? I could not find it

david-littlefield commented 3 years ago

@tamireiny The link is provided in @kimisecond 's answer. You'll need to copy and paste it into the web browser. And make sure to download the version that matches your Python version and Windows system type. For example, pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl refers to Python3.7 and Windows 64-bit.

tamireiny commented 3 years ago

@thealtruist I have managed to download the file now, but when I run: pip install pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl, I get: ERROR: pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl is not a supported wheel on this platform. I have python 3.7, windows 10 64 bit. Any idea how to solve?

david-littlefield commented 3 years ago

@tamireiny Can you verify the Python version? python --version

tamireiny commented 3 years ago

@thealtruist I run python --version Python 3.7.6

david-littlefield commented 3 years ago

@tamireiny Can you also verify the system type?

  1. Press “⊞ Windows”
  2. Enter "About"
  3. Click "About Your PC"
  4. Find "System Type"
tamireiny commented 3 years ago

@thealtruist image

david-littlefield commented 3 years ago

@tamireiny Could you also check your pip version? pip --version

tamireiny commented 3 years ago

@thealtruist , sure: pip --version pip 20.0.2 from c:\users\tamir\appdata\local\programs\python\python36\lib\site-packages\pip (python 3.6)

david-littlefield commented 3 years ago

@tamireiny It looks like your pip is connected to Python 3.6 and your interpreter is connected to Python 3.7

tamireiny commented 3 years ago

@thealtruist You are right, thanks. I used now the pip the is related to python 3.7 Then I try: import pydensecrf.densecrf as dcrf I get: Traceback (most recent call last): File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "F:\ShadowRemoval\Source\BDRAR\misc.py", line 4, in import pydensecrf.densecrf as dcrf ImportError: DLL load failed: The specified module could not be found.

What do you suggest?

david-littlefield commented 3 years ago

@tamireiny Were you able to successfully install pydensecrf using the pip that's related to Python 3.7?

tamireiny commented 3 years ago

@thealtruist Yes, when I try to install again I get: pip install pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Requirement already satisfied: pydensecrf==1.0rc2 from file:///C:/Users/Tamir/anaconda3/Scripts/pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl in c:\users\tamir\anaconda3\lib\site-packages (1.0rc2)

david-littlefield commented 3 years ago

@tamireiny Previously, have you set the Anaconda path in your Windows PATH Environment Variables?

tamireiny commented 3 years ago

@thealtruist Yes image

david-littlefield commented 3 years ago

@tamireiny I don't use Anaconda but it seems strange that it's trying to locate the module in Anaconda that you installed using pip.

tamireiny commented 3 years ago

@thealtruist I didn't understand your last comment, the error is: import pydensecrf.densecrf as dcrf ImportError: DLL load failed: The specified module could not be found.

Why do you think it's trying to locate modules using Anaocnda?

david-littlefield commented 3 years ago

@tamireiny That was a mistake. I was referring to it referencing the location of the site package.

Requirement already satisfied: pydensecrf==1.0rc2 from file:///C:/Users/Tamir/anaconda3/Scripts/pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl in c:\users\tamir\anaconda3\lib\site-packages (1.0rc2)

david-littlefield commented 3 years ago

@tamireiny But apparently that's a normal thing so I'm not sure what's causing the error.

tamireiny commented 3 years ago

@thealtruist Here in this folder path: C:\Users\Tamir\anaconda3\Scripts>

  1. activate
  2. conda install -c conda-forge pydensecrf The result is: Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: - Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort. Examining python=3.7: 67%|████████████████████████████████████████████████████████████ | 2/3 [00:00<00:00, 60.73it/s]/failed

UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:

Specifications:

Your python: python=3.7

If python is on the left-most side of the chain, that's the version you've asked for. When python appears to the right, that indicates that the thing on the left is somehow not available for the python version you are constrained to. Note that conda will not change your python version to a different minor version unless you explicitly specify that.

The following specifications were found to be incompatible with your CUDA driver:

Your installed CUDA driver is: 10.1

Seems that I got reject since there is no support for python 3.7

tamireiny commented 3 years ago

@thealtruist This worked for me: pip install pydensecrf-1.0rc2-cp37-cp37m-win_amd64.whl --no-deps

david-littlefield commented 3 years ago

@tamireiny Nice, glad you figured it out!

mu745511 commented 3 years ago

@david-littlefield AttributeError: module 'pydensecrf.densecrf' has no attribute 'DenseCRF2D' i get this attribute error

david-littlefield commented 3 years ago

@mu745511 What are the steps that you used to install?

mu745511 commented 3 years ago

@mu745511 What are the steps that you used to install?

import sys sys.path.append('github master pydensecrf')

actually i want to install it offline in kaggle notebook so i created a dataset using the github repo and import it using sys.path.append and then the error popped up , also i tried to install using internet like : pip install pydensecrf or using the pip install git+https://github.com/lucasb-eyer/pydensecrf.git command

python version in the kernel is 3.7.9 and cython is also installed

david-littlefield commented 3 years ago

@mu745511 It's been a while but I don't think you can just use pip install on this one. I think you need to install the wheel file for your specific Python version, operating system, and system type. You might try installing the wheel file as suggested here and here.

ezrabest commented 3 years ago

Thanks to all repliers Working with Pycharm instead of Anaconda solve the issue