iSarabjitDhiman / TweeterPy

TweeterPy is a python library to extract data from Twitter. TweeterPy API lets you scrape data from a user's profile like username, userid, bio, followers/followings list, profile media, tweets, etc.
MIT License
164 stars 29 forks source link

Building wheel for Brotli (pyproject.toml) did not run successfully. #46

Closed lthrn closed 5 months ago

lthrn commented 10 months ago

Hi!

I wasn't able to install the package correctly. The following errors are thrown:

SCR-20240111-gdz-2

SCR-20240111-gho-2

I googled the errors but I couldn't really figured out what to do. I'm a newbie with python.

Thanks in advance.

iSarabjitDhiman commented 10 months ago

Hey @lthrn, Actually the error is related to the Brotli package. Check the 2nd picture you have shared. You are advised to install "Microsoft C++ Build tools".

lthrn commented 10 months ago

Hi @iSarabjitDhiman!

Thanks a lot! For some reason I didn't see those lines. I'm sorry.

I already installed all Microsoft Visual C++ requirements successfully and it seems both errors were solved. However, there is a new one. It looks that the lxml is looking for some files but cannot locate them. Here is the output:

Building wheels for collected packages: lxml
  Building wheel for lxml (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for lxml (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [124 lines of output]
      <string>:117: SyntaxWarning: invalid escape sequence '\.'
      <string>:67: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      Building lxml version 4.9.2.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\builder.py -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\cssselect.py -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\doctestcompare.py -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\ElementInclude.py -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\sax.py -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\usedoctest.py -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\_elementpath.py -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\__init__.py -> build\lib.win-amd64-cpython-312\lxml
      creating build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\__init__.py -> build\lib.win-amd64-cpython-312\lxml\includes
      creating build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\builder.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\clean.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\defs.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\diff.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\formfill.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\html5parser.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\soupparser.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-cpython-312\lxml\html
      copying src\lxml\html\__init__.py -> build\lib.win-amd64-cpython-312\lxml\html
      creating build\lib.win-amd64-cpython-312\lxml\isoschematron
      copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-cpython-312\lxml\isoschematron
      copying src\lxml\etree.h -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\etree_api.h -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\lxml.etree.h -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\etree.pyx -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\objectify.pyx -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\apihelpers.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\classlookup.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\cleanup.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\debug.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\docloader.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\dtd.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\extensions.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\iterparse.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\nsclasses.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\objectpath.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\parser.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\parsertarget.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\proxy.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\public-api.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\readonlytree.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\relaxng.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\saxparser.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\schematron.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\serializer.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\xinclude.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\xmlerror.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\xmlid.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\xmlschema.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\xpath.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\xslt.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\xsltext.pxi -> build\lib.win-amd64-cpython-312\lxml
      copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\config.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-cpython-312\lxml\includes
      copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-cpython-312\lxml\includes
      creating build\lib.win-amd64-cpython-312\lxml\isoschematron\resources
      creating build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\rng
      copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\rng
      creating build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl
      copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl
      creating build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-cpython-312\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-cpython-312\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-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-cpython-312\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build\temp.win-amd64-cpython-312
      creating build\temp.win-amd64-cpython-312\Release
      creating build\temp.win-amd64-cpython-312\Release\src
      creating build\temp.win-amd64-cpython-312\Release\src\lxml
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc\lxml\includes "-IC:\Program Files\Python312\include" "-IC:\Program Files\Python312\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcsrc\lxml\etree.c /Fobuild\temp.win-amd64-cpython-312\Release\src\lxml\etree.obj -w
      cl : L¡nea de comandos warning D9025 : invalidando '/W3' con '/w'
      etree.c
      C:\Users\XXXXXX\AppData\Local\Temp\pip-install-xlsgapl0\lxml_a92c682e671547e1906fc44610802e2e\src\lxml\includes/etree_defs.h(14): fatal error C1083: No se puede abrir el archivo incluir: 'libxml/xmlversion.h': No such file or directory
      Compile failed: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      creating Users
      creating Users\XXXXXX
      creating Users\XXXXXX\AppData
      creating Users\XXXXXX\AppData\Local
      creating Users\XXXXXX\AppData\Local\Temp
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /TcC:\Users\XXXXXX\AppData\Local\Temp\xmlXPathInith5vxlkpp.c /FoUsers\XXXXXX\AppData\Local\Temp\xmlXPathInith5vxlkpp.obj
      xmlXPathInith5vxlkpp.c
      C:\Users\XXXXXX\AppData\Local\Temp\xmlXPathInith5vxlkpp.c(1): fatal error C1083: No se puede abrir el archivo incluir: 'libxml/xpath.h': No such file or directory
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.38.33130\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lxml
Failed to build lxml
ERROR: Could not build wheels for lxml, which is required to install pyproject.toml-based projects

What I've tried so far:

Thanks in advance for your kind help.

iSarabjitDhiman commented 9 months ago

Hey, I will fix it soon.

here is a quick fix, just in case you want to do it yourself: Clone the repo, remove lxml from requirements, build and then install the modified version that u just built.

You can use html5lib as a replacement.

exentio commented 6 months ago

I'm experiencing this same issue, in my case I worked around it by updating the version of lxml in the requirements.txt of my project (5.2.1 at the time of writing), which in my case contains every single dependency. From there, I ran pip install -r requirements.txt --no-deps, and it worked. @iSarabjitDhiman is there any update about the fix? It should be just a dependency version bump, although maybe it'd be better to run proper tests beforehand

iSarabjitDhiman commented 6 months ago

I'm experiencing this same issue, in my case I worked around it by updating the version of lxml in the requirements.txt of my project (5.2.1 at the time of writing), which in my case contains every single dependency. From there, I ran pip install -r requirements.txt --no-deps, and it worked. @iSarabjitDhiman is there any update about the fix? It should be just a dependency version bump, although maybe it'd be better to run proper tests beforehand

Hey @exentio thanks for the update. I was planning to replace lxml with html5lib (which is a bit slow) because lxml is dependent on C. image Therefore, in Windows, sometimes the user is required to install microsoft visual studio build tools. But thanks again, for the update, maybe I will just bump the lxml version for the time being.

exentio commented 6 months ago

It makes sense, I'd appreciate it if you could bump the dependency version as a temporary solution, but I agree with the decision to swap libraries