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

Installation on windows fails without netifaces (optional) dependency #1027

Open
euronion opened this issue May 2, 2021 · 7 comments
Open
Labels

Comments

@euronion
Copy link

euronion commented May 2, 2021

I am unable to install python-miio on windows.
I do not have Microsoft Visual C++ 14.0 (or greater) installed, thus the installation fails when trying to install netifaces.

As I understood it netifaces should be an optional dependency and not be required for the installation on Windows since release 0.5.5 (#964 ).

Version information (please complete the following information):

  • OS: Windows 10 Pro 20H2
  • python-miio: None (unable to install)

Device information:
n/a

To Reproduce
Steps to reproduce the behavior (I am using conda and mamba instead of virtualenv):

conda create --name miio
conda activate miio
mamba install -c conda-forge python pip wheel
pip install python-miio

Expected behavior
python-miio should be installed without netifaces being required.

Console output

Expand here
(miio) C:\Users\<USER>>pip install python-miio
Collecting python-miio
  Using cached python_miio-0.5.5.2-py3-none-any.whl (267 kB)
Collecting android_backup<1,>=0
  Using cached android_backup-0.2.0-py3-none-any.whl
Collecting attrs
  Using cached attrs-20.3.0-py2.py3-none-any.whl (49 kB)
Collecting tqdm<5,>=4
  Using cached tqdm-4.60.0-py2.py3-none-any.whl (75 kB)
Collecting construct<3.0.0,>=2.10.56
  Using cached construct-2.10.67-py3-none-any.whl
Collecting defusedxml<0.7,>=0.6
  Using cached defusedxml-0.6.0-py2.py3-none-any.whl (23 kB)
Collecting zeroconf<0.29,>=0.28
  Using cached zeroconf-0.28.8-py3-none-any.whl (55 kB)
Collecting cryptography<4,>=3
  Using cached cryptography-3.4.7-cp36-abi3-win_amd64.whl (1.6 MB)
Collecting appdirs<2,>=1
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Collecting PyYAML<6,>=5
  Using cached PyYAML-5.4.1-cp39-cp39-win_amd64.whl (213 kB)
Collecting click<8,>=7
  Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting pytz
  Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB)
Collecting croniter<1,>=0
  Using cached croniter-0.3.37-py2.py3-none-any.whl (13 kB)
Collecting netifaces<1,>=0
  Using cached netifaces-0.10.9.tar.gz (28 kB)
Collecting python-dateutil
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting natsort
  Using cached natsort-7.1.1-py3-none-any.whl (35 kB)
Collecting cffi>=1.12
  Using cached cffi-1.14.5-cp39-cp39-win_amd64.whl (179 kB)
Collecting pycparser
  Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
Collecting ifaddr>=0.1.7
  Using cached ifaddr-0.1.7-py2.py3-none-any.whl (10 kB)
Collecting six>=1.5
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Building wheels for collected packages: netifaces
  Building wheel for netifaces (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\anaconda\envs\miio\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\<USER>\\AppData\\Local\\Temp\\pip-install-0umu1zai\\netifaces_0c685e1d61f44e77a2db8efd3aa4422d\\setup.py'"'"'; __file__='"'"'C:\\Users\\<USER>\\AppData\\Local\\Temp\\pip-install-0umu1zai\\netifaces_0c685e1d61f44e77a2db8efd3aa4422d\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\<USER>\AppData\Local\Temp\pip-wheel-6fpjjnyp'
       cwd: C:\Users\<USER>\AppData\Local\Temp\pip-install-0umu1zai\netifaces_0c685e1d61f44e77a2db8efd3aa4422d\
  Complete output (5 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'netifaces' 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/
  ----------------------------------------
  ERROR: Failed building wheel for netifaces
  Running setup.py clean for netifaces
Failed to build netifaces
Installing collected packages: six, pycparser, python-dateutil, natsort, ifaddr, cffi, zeroconf, tqdm, PyYAML, pytz, netifaces, defusedxml, cryptography, croniter, construct, click, attrs, appdirs, android-backup, python-miio
    Running setup.py install for netifaces ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\anaconda\envs\miio\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\<USER>\\AppData\\Local\\Temp\\pip-install-0umu1zai\\netifaces_0c685e1d61f44e77a2db8efd3aa4422d\\setup.py'"'"'; __file__='"'"'C:\\Users\\<USER>\\AppData\\Local\\Temp\\pip-install-0umu1zai\\netifaces_0c685e1d61f44e77a2db8efd3aa4422d\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\<USER>\AppData\Local\Temp\pip-record-3rall3rl\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\anaconda\envs\miio\Include\netifaces'
         cwd: C:\Users\<USER>\AppData\Local\Temp\pip-install-0umu1zai\netifaces_0c685e1d61f44e77a2db8efd3aa4422d\
    Complete output (5 lines):
    running install
    running build
    running build_ext
    building 'netifaces' 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/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\anaconda\envs\miio\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\<USER>\\AppData\\Local\\Temp\\pip-install-0umu1zai\\netifaces_0c685e1d61f44e77a2db8efd3aa4422d\\setup.py'"'"'; __file__='"'"'C:\\Users\\<USER>\\AppData\\Local\\Temp\\pip-install-0umu1zai\\netifaces_0c685e1d61f44e77a2db8efd3aa4422d\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\<USER>\AppData\Local\Temp\pip-record-3rall3rl\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\anaconda\envs\miio\Include\netifaces' Check the logs for full command output.
@euronion euronion added the bug label May 2, 2021
@rytilahti
Copy link
Owner

rytilahti commented May 3, 2021

Ohh, looks like this might be a bug in poetry: python-poetry/poetry#2357 . Could you try to install from the source package using pip install python-miio --no-binary python-miio to see if that works? It seems to be terribly slow though, likely related to the rust dependency (#997)..

edit: looks like that is not working either, this needs some more investigation, but optional dependencies should definitely not be required to install the package :-(

@euronion
Copy link
Author

euronion commented May 3, 2021

Ahh, that's unfortunate but I guess nothing we can do about it?
(I'll head out and install Visual C++ in the meantime.)

@rytilahti
Copy link
Owner

That will need some investigation, but I hope a solution can be found.

@rytilahti
Copy link
Owner

@euronion I just realized that disabling the dependency installation (--no-deps) as mentioned in the original issue can be used as a workaround (that's how I tested that the lib itself works instead of installing the vc++). The netifaces is only used in a single place in the code (the updater uses it to find the interface for binding, iirc), so it shouldn't hinder any other uses.

@euronion
Copy link
Author

euronion commented May 6, 2021

That's an amazingly simple workaround! Thanks, worked like a charm.

@thelittleerik
Copy link

Its still not fixed and its extremely frustrating

@rytilahti
Copy link
Owner

@thelittleerik are you sure? #1738 should have actually fixed this for good, but there has been no releases since then, so you'd need to use the current master branch checkout or do pip install --pre python-miio (which installs the pre-release).

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

No branches or pull requests

3 participants