ffalcinelli / pydivert

A Python binding for WinDivert driver
GNU Lesser General Public License v3.0
207 stars 36 forks source link

Cannot install in virtualenv #9

Closed mhils closed 8 years ago

mhils commented 9 years ago

Hi @ffalcinelli,

I face the following issue when installing pydivert into a virtualenv:

C:\Users\user>virtualenv test
New python executable in test\Scripts\python.exe
Installing setuptools, pip, wheel...done.

C:\Users\user>test\Scripts\activate

(test) C:\Users\user>pip install pydivert
Collecting pydivert
  Using cached pydivert-0.0.7.zip
Building wheels for collected packages: pydivert
  Running setup.py bdist_wheel for pydivert
  Complete output from command C:\Users\user\test\Scripts\python.exe -c "import setuptools;__file__='c:\\users\\user\\appdata\\local\\temp\\pip-build-eyvqoo\\pydivert\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d c:\users\user\appdata\local\temp\tmpt3ce8apip-wheel-:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib
  creating build\lib\pydivert
  copying pydivert\decorators.py -> build\lib\pydivert
  copying pydivert\enum.py -> build\lib\pydivert
  copying pydivert\exception.py -> build\lib\pydivert
  copying pydivert\install.py -> build\lib\pydivert
  copying pydivert\models.py -> build\lib\pydivert
  copying pydivert\windivert.py -> build\lib\pydivert
  copying pydivert\winutils.py -> build\lib\pydivert
  copying pydivert\__init__.py -> build\lib\pydivert
  creating build\lib\pydivert\tests
  copying pydivert\tests\test_installer.py -> build\lib\pydivert\tests
  copying pydivert\tests\test_models.py -> build\lib\pydivert\tests
  copying pydivert\tests\test_windivert.py -> build\lib\pydivert\tests
  copying pydivert\tests\test_winutils.py -> build\lib\pydivert\tests
  copying pydivert\tests\__init__.py -> build\lib\pydivert\tests
  installing to build\bdist.win32\wheel
  running install
  running install_lib
  creating build\bdist.win32
  creating build\bdist.win32\wheel
  creating build\bdist.win32\wheel\pydivert
  copying build\lib\pydivert\decorators.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert
  copying build\lib\pydivert\enum.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert
  copying build\lib\pydivert\exception.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert
  copying build\lib\pydivert\install.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert
  copying build\lib\pydivert\models.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert
  creating build\bdist.win32\wheel\pydivert\tests
  copying build\lib\pydivert\tests\test_installer.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert\tests
  copying build\lib\pydivert\tests\test_models.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert\tests
  copying build\lib\pydivert\tests\test_windivert.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert\tests
  copying build\lib\pydivert\tests\test_winutils.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert\tests
  copying build\lib\pydivert\tests\__init__.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert\tests
  copying build\lib\pydivert\windivert.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert
  copying build\lib\pydivert\winutils.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert
  copying build\lib\pydivert\__init__.py -> build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert
  running install_egg_info
  running egg_info
  writing requirements to pydivert.egg-info\requires.txt
  writing pydivert.egg-info\PKG-INFO
  writing top-level names to pydivert.egg-info\top_level.txt
  writing dependency_links to pydivert.egg-info\dependency_links.txt
  warning: manifest_maker: standard file '-c' not found

  reading manifest file 'pydivert.egg-info\SOURCES.txt'
  writing manifest file 'pydivert.egg-info\SOURCES.txt'
  Copying pydivert.egg-info to build\bdist.win32\wheel\pydivert-0.0.7.data\..\pydivert-0.0.7-py2.7.egg-info
  running install_scripts
  Running WinDivert install task
  Downloading https://github.com/basil00/Divert/releases/download/v1.1.7/WinDivert-1.1.7-WDDK.zip...
  Uncompressing WinDivert-1.1.7-WDDK.zip...
  Copying build\bdist.win32\wheel\pydivert-0.0.7.data\..\WinDivert-1.1.7-WDDK\x86\WinDivert.dll to C:\Users\user\test\DLLs
  error: [Errno 2] No such file or directory: 'build\\bdist.win32\\wheel\\pydivert-0.0.7.data\\..\\WinDivert-1.1.7-WDDK\\x86\\WinDivert.dll'

  ----------------------------------------
  Failed building wheel for pydivert
Failed to build pydivert
Installing collected packages: pydivert
  Running setup.py install for pydivert
Successfully installed pydivert-0.0.7

Apparently there's an error with the DLL path. I'm not sure where the issue lies, but another interesting observation might be that pydivert creates a DLLs file (not folder) in the virtualenv.

(test) C:\Users\user\test>ls -l
total 85
-rwxr-xr-x 1 user Kein 38064 Aug 28 02:14 DLLs
drwxr-xr-x 1 user Kein     0 Aug 19 14:25 Include
drwxr-xr-x 1 user Kein     0 Aug 28 02:13 Lib
drwxr-xr-x 1 user Kein     0 Aug 28 02:13 Scripts
-rw-r--r-- 1 user Kein    60 Aug 28 02:14 pip-selfcheck.json

Any ideas how this could be fixed?

ffalcinelli commented 9 years ago

Sorry for the late response, I was in holidays... I'll going to check this soon, I had not take virtualenv into account since the windivert driver is installed system wide, so conflicts could arise if several different version of the binding would be installed in the system

ffalcinelli commented 9 years ago

Well seems to work by just creating the directory DLLs if does not exist. Now I have to check the unittests but this is another story...

mhils commented 8 years ago

fixed by #11.