kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.66k stars 265 forks source link

Install throws error related to lxml without wheel package: "error: Microsoft Visual C++ 14.0 or greater is required. " #218

Open aa-dank opened 3 years ago

aa-dank commented 3 years ago

A fellow employee ran into an error when trying to install a tool I built with yagmail (which is otherwise great btw). It appears that after not finding wheel installed it looks for some other way but throws an error if C++ is not installed. I did not see C++ install as a necessary dependency in yagmail documentation:

U:\>pip install yagmail

Collecting yagmail

  Downloading yagmail-0.14.260-py2.py3-none-any.whl (16 kB)

Collecting premailer

  Downloading premailer-3.10.0-py2.py3-none-any.whl (19 kB)

Collecting cssselect

  Downloading cssselect-1.1.0-py2.py3-none-any.whl (16 kB)

Collecting cachetools

  Downloading cachetools-4.2.4-py3-none-any.whl (10 kB)

Collecting lxml

  Downloading lxml-4.6.3.tar.gz (3.2 MB)

     |████████████████████████████████| 3.2 MB 3.3 MB/s

Collecting cssutils

  Downloading cssutils-2.3.0-py3-none-any.whl (404 kB)

     |████████████████████████████████| 404 kB ...

Collecting requests

  Downloading requests-2.26.0-py2.py3-none-any.whl (62 kB)

     |████████████████████████████████| 62 kB ...

Collecting urllib3<1.27,>=1.21.1

  Downloading urllib3-1.26.7-py2.py3-none-any.whl (138 kB)

     |████████████████████████████████| 138 kB 6.4 MB/s

Collecting certifi>=2017.4.17

  Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)

     |████████████████████████████████| 149 kB 6.8 MB/s

Collecting idna<4,>=2.5

  Downloading idna-3.3-py3-none-any.whl (61 kB)

     |████████████████████████████████| 61 kB 4.0 MB/s

Collecting charset-normalizer~=2.0.0

  Downloading charset_normalizer-2.0.7-py3-none-any.whl (38 kB)

Using legacy 'setup.py install' for lxml, since package 'wheel' is not installed.

Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests, lxml, cssutils, cssselect, cachetools, premailer, yagmail

    Running setup.py install for lxml ... error

    ERROR: Command errored out with exit status 1:

     command: 'C:\Users\bjesse\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bjesse\\AppData\\Local\\Temp\\pip-install-2o6b4x37\\lxml_fbd419f1200b46269461fff44ca71876\\setup.py'"'"'; __file__='"'"'C:\\Users\\bjesse\\AppData\\Local\\Temp\\pip-install-2o6b4x37\\lxml_fbd419f1200b46269461fff44ca71876\\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\bjesse\AppData\Local\Temp\pip-record-xdwchmyn\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\bjesse\AppData\Local\Programs\Python\Python310\Include\lxml'

         cwd: C:\Users\bjesse\AppData\Local\Temp\pip-install-2o6b4x37\lxml_fbd419f1200b46269461fff44ca71876\

    Complete output (74 lines):

    Building lxml version 4.6.3.

    Building without Cython.

    Building against pre-built libxml2 andl libxslt libraries

    running install

    running build

    running build_py

    creating build

    creating build\lib.win-amd64-3.10

    creating build\lib.win-amd64-3.10\lxml

    copying src\lxml\builder.py -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\cssselect.py -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\doctestcompare.py -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\ElementInclude.py -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\sax.py -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\usedoctest.py -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\_elementpath.py -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\__init__.py -> build\lib.win-amd64-3.10\lxml

    creating build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\__init__.py -> build\lib.win-amd64-3.10\lxml\includes

    creating build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\builder.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\clean.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\defs.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\diff.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\formfill.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\html5parser.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\soupparser.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-3.10\lxml\html

    copying src\lxml\html\__init__.py -> build\lib.win-amd64-3.10\lxml\html

    creating build\lib.win-amd64-3.10\lxml\isoschematron

    copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-3.10\lxml\isoschematron

    copying src\lxml\etree.h -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\etree_api.h -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\lxml.etree.h -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-3.10\lxml

    copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\config.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-3.10\lxml\includes

    copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-3.10\lxml\includes

    creating build\lib.win-amd64-3.10\lxml\isoschematron\resources

    creating build\lib.win-amd64-3.10\lxml\isoschematron\resources\rng

    copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\rng

    creating build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl

    copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl

    copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl

    creating build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

   copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-3.10\lxml\isoschematron\resources\xsl\iso-schematron-xslt1

    running build_ext

    building 'lxml.etree' 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:\Users\bjesse\AppData\Local\Programs\Python\Python310\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\bjesse\\AppData\\Local\\Temp\\pip-install-2o6b4x37\\lxml_fbd419f1200b46269461fff44ca71876\\setup.py'"'"'; __file__='"'"'C:\\Users\\bjesse\\AppData\\Local\\Temp\\pip-install-2o6b4x37\\lxml_fbd419f1200b46269461fff44ca71876\\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\bjesse\AppData\Local\Temp\pip-record-xdwchmyn\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\bjesse\AppData\Local\Programs\Python\Python310\Include\lxml' Check the logs for full command output.
aa-dank commented 3 years ago

Wondering why it wouldn't just install wheel like it would for other python dependencies?

kootenpv commented 3 years ago

It's very weird. But maybe it means you miss some generic developer requirements? Did you find an answer on stackoverflow or something?

aa-dank commented 3 years ago

The problem appears to be with python 3.10 Try installing yagmail in a python 3.10 environment

I had a coworker and a contractor try to install yagmail. It continued breaking despite efforts to install lxml and wheel individually. It only worked on both computers after installing python 3.9 instead of python 3.10.

kootenpv commented 3 years ago

Sorry, I guess it is waiting for 3.10 to mature further?

YSCohen commented 2 years ago

this is also a problem on python 3.11

kootenpv commented 2 years ago

So does it work if you first install windows stuff