question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error installing bleak on Windows 10

See original GitHub issue
  • bleak version: 0.4.0
  • Python version: Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
  • Operating System: Windows 10

Description

When installing bleak, there was an error importing basetsd.h. After installing Windows SDK, the installation output changed, but the error persists.

What I Did

When I run pip install bleak the following stack trace appears:

PS C:\Users\GuilhermeMussi\Desktop\esp32py> pip install bleak
Collecting bleak
  Using cached https://files.pythonhosted.org/packages/3a/0e/ce9655465ac5455f9bbec5cb41b007a26bd889792fd1d4963f6f99d88b1a/bleak-0.4.0-py2.py3-none-any.whl
Collecting pythonnet; platform_system == "Windows" (from bleak)
  Using cached https://files.pythonhosted.org/packages/89/3b/a22cd45b591d6cf490ee8b24d52b9db1f30b4b478b64a9b231c53474731e/pythonnet-2.3.0.tar.gz
Installing collected packages: pythonnet, bleak
  Running setup.py install for pythonnet ... error
    ERROR: Complete output from command 'c:\users\guilhermemussi\appdata\local\programs\python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\GUILHE~1\\AppData\\Local\\Temp\\pip-install-pbsf463r\\pythonnet\\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\GUILHE~1\AppData\Local\Temp\pip-record-v4n1x0hi\install-record.txt' --single-version-externally-managed --compile:
    ERROR: running install
    running build
    running build_ext
    Checking for updates from https://www.nuget.org/api/v2/.
    Currently running NuGet.exe 3.5.0.
    Updating NuGet.exe to 4.9.4.
    Update successful.
    MSBuild auto-detection: using msbuild version '16.0.461.62831' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin'.
    Restoring NuGet package NUnit.3.6.0.
    Restoring NuGet package NUnit.ConsoleRunner.3.6.0.
    Restoring NuGet package UnmanagedExports.1.2.7.
    Adding package 'NUnit.ConsoleRunner.3.6.0' to folder 'C:\Users\GuilhermeMussi\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\packages'
    Adding package 'UnmanagedExports.1.2.7' to folder 'C:\Users\GuilhermeMussi\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\packages'
    Adding package 'NUnit.3.6.0' to folder 'C:\Users\GuilhermeMussi\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\packages'
    Added package 'UnmanagedExports.1.2.7' to folder 'C:\Users\GuilhermeMussi\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\packages'
    Added package 'NUnit.ConsoleRunner.3.6.0' to folder 'C:\Users\GuilhermeMussi\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\packages'
    Added package 'NUnit.3.6.0' to folder 'C:\Users\GuilhermeMussi\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\packages'

    NuGet Config files used:
        C:\Users\GuilhermeMussi\AppData\Roaming\NuGet\NuGet.Config

    Feeds used:
        C:\Users\GuilhermeMussi\.nuget\packages\
        https://api.nuget.org/v3/index.json

    Installed:
        3 package(s) to packages.config projects
    clang.exe: warning: c:\users\guilhermemussi\appdata\local\programs\python\python37\Include: 'linker' input unused
    In file included from c:\users\guilhermemussi\appdata\local\programs\python\python37\Include\Python.h:8:
    c:\users\guilhermemussi\appdata\local\programs\python\python37\Include/pyconfig.h:215:10: fatal error: 'basetsd.h' file not found
    #include <basetsd.h>
             ^
    1 error generated.
    Traceback (most recent call last):
      File "tools\geninterop\geninterop.py", line 292, in <module>
        sys.exit(main())
      File "tools\geninterop\geninterop.py", line 272, in main
        python_h = preprocess_python_headers()
      File "tools\geninterop\geninterop.py", line 192, in preprocess_python_headers
        for line in _check_output(cmd).splitlines():
      File "tools\geninterop\geninterop.py", line 41, in _check_output
        output = subprocess.check_output(*args, **kwargs)
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\subprocess.py", line 376, in check_output
        **kwargs).stdout
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\subprocess.py", line 468, in run
        output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '['clang', '-I', 'tools\\geninterop\\fake_libc_include', 'c:\\users\\guilhermemussi\\appdata\\local\\programs\\python\\python37\\Include', '-D', '__attribute__(x)=', '-D', '__inline__=inline', '-D', '__asm__=;#pragma asm', '-D', '__int64=long long', '-E', 'c:\\users\\guilhermemussi\\appdata\\local\\programs\\python\\python37\\Include\\Python.h']' returned non-zero exit status 1.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\GUILHE~1\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\setup.py", line 405, in <module>
        zip_safe=False,
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\command\build_ext.py", line 339, in run
        self.build_extensions()
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\command\build_ext.py", line 448, in build_extensions
        self._build_extensions_serial()
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\distutils\command\build_ext.py", line 473, in _build_extensions_serial
        self.build_extension(ext)
      File "C:\Users\GUILHE~1\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\setup.py", line 191, in build_extension
        subprocess.check_call([sys.executable, geninterop, interop_file])
      File "c:\users\guilhermemussi\appdata\local\programs\python\python37\lib\subprocess.py", line 328, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['c:\\users\\guilhermemussi\\appdata\\local\\programs\\python\\python37\\python.exe', 'tools\\geninterop\\geninterop.py', 'src\\runtime\\interop37.cs']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command "'c:\users\guilhermemussi\appdata\local\programs\python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\GUILHE~1\\AppData\\Local\\Temp\\pip-install-pbsf463r\\pythonnet\\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\GUILHE~1\AppData\Local\Temp\pip-record-v4n1x0hi\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\GUILHE~1\AppData\Local\Temp\pip-install-pbsf463r\pythonnet\

I am not sure what else I can do. Any help would be appreciated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gmussicommented, May 23, 2019

@hbldh I’ve followed the sugestion of @dlech and it worked fine, using 3.6 instead of 3.7. I am closing the issue.

0reactions
hbldhcommented, May 17, 2019

@gmussi Did you get this to work? May 4, the version 2.4 of pythonnet was released, and it has Python 3.7 wheels so try to install that instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I can't install the bleak module on windows 10 - Stack Overflow
I get the following error while trying to install bleak using: pip instal bleak (I use spyder via anaconda and I have already...
Read more >
Troubleshooting — bleak 0.20.0a1 documentation
Open a terminal as Administrator. Search start menu for cmd . (Powershell and Windows Terminal are fine too.) · Run C:\BTP\v1.9.0\x86\btvs.exe . ·...
Read more >
bleak · PyPI
Bleak is a GATT client software, capable of connecting to BLE devices acting as GATT servers. It is designed to provide a asynchronous,...
Read more >
bleak - Python Package Health Analysis - Snyk
Learn more about bleak: package health score, popularity, security, maintenance, versions and more.
Read more >
Interfacing to a PC - Espruino
`bleak' is a newer multiplatform Python Library that supports Windows, Mac OS and Linux. Bleak. You need to run pip install bleak ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found