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

Unable to install tlsh (Fatal Error C1083) #94

Closed
DWetherilt opened this issue Nov 25, 2020 · 13 comments
Closed

Unable to install tlsh (Fatal Error C1083) #94

DWetherilt opened this issue Nov 25, 2020 · 13 comments

Comments

@DWetherilt
Copy link

DWetherilt commented Nov 25, 2020

I have tried to install using pip and I get an error saying "Cannot open include file WinFunctions.h : No such file or directory"

I'm using windows server with python 3.9 and pywin. MSVC++ build tools 14 is installed and I am issuing the command "pip install python-tlsh" to trigger the installation. My Path variables point to the base python folder, the scripts folder and the include folder.

I'm guessing I'm missing something obvious, but would appreciate any pointers.

Thank you!

@jonjoliver
Copy link
Collaborator

jonjoliver commented Nov 25, 2020

We are not in charge of the pip installer.
But I will try to help.
Let me see about this.

@DWetherilt
Copy link
Author

Thank you, I appreciate you taking the time to have a quick look for me!

Windows Server 2019
python 3.9.0
pywin 32 300

@jonjoliver
Copy link
Collaborator

I am a linux / Mac programmer - so I am going to have to work through this.
But I think it is important that I get TLSH working well on Windows in Python.
(I was able to use minGW to get it all compiling on Windows - and made tlsh.exe available)
I have set up Azure account - and got Windows Server 2019 instance set up.

Could you please point me to the same websites you used for installing Python 3.9 and pywin 32 300?
That will maximise the chance that we fix this all up...
:-)

@jonjoliver
Copy link
Collaborator

Ok - I have tried

py -m pip install python-tlsh
I did this without the wheel package and with the wheel package.
Both failed.

I get the same as you:
include\tlsh.h(117): fatal error C1083: Cannot open include file: 'WinFunctions.h': No such file or directory

It appears that the python-tlsh package may be broken for windows...
I will try to find out who owns this package - and get it fixed.

In the meantime, I will try to figure out another way to get tlsh working in python on Windows

@DWetherilt
Copy link
Author

Thanks for confirming my suspicions and appreciate you taking the time to help me.

@DWetherilt
Copy link
Author

@jonjoliver: Did you manage to flag this with the package maintainer at all?

@jonjoliver
Copy link
Collaborator

jonjoliver commented Dec 3, 2020

I have set up a new python repo called py-tlsh
I have done the minimum changes that appears to fix Windows
@DWetherilt could yes test for your environment. This works on my windows server 2019 instance in Azure.

py -m pip install -i https://test.pypi.org/simple/ py-tlsh

If that works - then I will bring this library up to date

  • include JSON object output
  • fix 2GB and the q3=0 issues
  • add T1 to the beginning of the digest (hash version - with backwards compatibility)

@DWetherilt
Copy link
Author

Oh wow, thanks for digging in to that. I’ve put some time aside on Monday to test this. I’ll report back here with my results.

@DWetherilt
Copy link
Author

I couldn't wait until Monday, so found some time tonight to give this a quick try so I can get an answer to you. That package installed perfectly and I have made a quick script importing tlsh and performed a quick hash and comparison routine which worked as expected.

@jonjoliver
Copy link
Collaborator

I have set up the package py-tlsh on pypi.org
You can see it at https://pypi.org/project/py-tlsh/
This works on Windows and has other improvements.
You can install it by
$ pip install py-tlsh

@jonjoliver
Copy link
Collaborator

with the creation of py-tlsh package on PyPi.org this issue should be resolved

jonjoliver pushed a commit that referenced this issue Dec 17, 2020
@KiaraR
Copy link

KiaraR commented Nov 21, 2022

I have same issue, i am also working in Windows and
pip3 install py-tlsh also doesnt work..

@mik1232
Copy link

mik1232 commented Feb 16, 2023

Hello @jonjoliver , thank you for your efforts.
I have some issues with installing tlsh both with pip install py-tlsh and pip install python-tlsh,
I already installed Visual Studio, enabled C++ Build tools and both with Pycharm and with the command prompt in windows (run as admin) i get this error:

Collecting py-tlsh
  Using cached py-tlsh-4.7.2.tar.gz (42 kB)
  Preparing metadata (setup.py) ... done
Installing collected packages: py-tlsh
  DEPRECATION: py-tlsh is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for py-tlsh ... error
  error: subprocess-exited-with-error

  × Running setup.py install for py-tlsh did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      running install
      C:\Users\myname\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'tlsh' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> py-tlsh

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

C:\Windows\System32>pip install python-tlsh
Collecting python-tlsh
  Using cached python-tlsh-4.5.0.tar.gz (40 kB)
  Preparing metadata (setup.py) ... done
Installing collected packages: python-tlsh
  DEPRECATION: python-tlsh is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for python-tlsh ... error
  error: subprocess-exited-with-error

  × Running setup.py install for python-tlsh did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      running install
      C:\Users\myname\AppData\Local\Programs\Python\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'tlsh' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> python-tlsh

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.



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