skip to Main Content

I am trying to install pandas datareader, but I am hit with this error:

Collecting pandas-datareader
  Using cached pandas_datareader-0.10.0-py3-none-any.whl (109 kB)
Collecting lxml
  Using cached lxml-4.9.1.tar.gz (3.4 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: pandas>=0.23 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from pandas-datareader) (1.5.2)
Requirement already satisfied: requests>=2.19.0 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from pandas-datareader) (2.28.1)
Requirement already satisfied: python-dateutil>=2.8.1 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from pandas>=0.23->pandas-datareader) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from pandas>=0.23->pandas-datareader) (2022.6)
Requirement already satisfied: numpy>=1.21.0 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from pandas>=0.23->pandas-datareader) (1.23.5)
Requirement already satisfied: charset-normalizer<3,>=2 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from requests>=2.19.0->pandas-datareader) (2.1.1)
Requirement already satisfied: idna<4,>=2.5 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from requests>=2.19.0->pandas-datareader) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from requests>=2.19.0->pandas-datareader) (1.26.13)
Requirement already satisfied: certifi>=2017.4.17 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from requests>=2.19.0->pandas-datareader) (2022.9.24)
Requirement already satisfied: six>=1.5 in c:usersmarcuappdatalocalprogramspythonpython311libsite-packages (from python-dateutil>=2.8.1->pandas>=0.23->pandas-datareader) (1.16.0)
Installing collected packages: lxml, pandas-datareader
  DEPRECATION: lxml 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 lxml ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lxml did not run successfully.
  │ exit code: 1
  ╰─> [96 lines of output]
      Building lxml version 4.9.1.
      Building without Cython.
      Building against pre-built libxml2 andl libxslt libraries
      running install
      C:UsersmarcuAppDataLocalProgramsPythonPython311Libsite-packagessetuptoolscommandinstall.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating buildlib.win-amd64-cpython-311
      creating buildlib.win-amd64-cpython-311lxml
      copying srclxmlbuilder.py -> buildlib.win-amd64-cpython-311lxml
      copying srclxmlcssselect.py -> buildlib.win-amd64-cpython-311lxml
      copying srclxmldoctestcompare.py -> buildlib.win-amd64-cpython-311lxml
      copying srclxmlElementInclude.py -> buildlib.win-amd64-cpython-311lxml
      copying srclxmlpyclasslookup.py -> buildlib.win-amd64-cpython-311lxml
      copying srclxmlsax.py -> buildlib.win-amd64-cpython-311lxml
      copying srclxmlusedoctest.py -> buildlib.win-amd64-cpython-311lxml
      copying srclxml_elementpath.py -> buildlib.win-amd64-cpython-311lxml
      copying srclxml__init__.py -> buildlib.win-amd64-cpython-311lxml
      creating buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludes__init__.py -> buildlib.win-amd64-cpython-311lxmlincludes
      creating buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmlbuilder.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmlclean.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmldefs.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmldiff.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmlElementSoup.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmlformfill.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmlhtml5parser.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmlsoupparser.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtmlusedoctest.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtml_diffcommand.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtml_html5builder.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtml_setmixin.py -> buildlib.win-amd64-cpython-311lxmlhtml
      copying srclxmlhtml__init__.py -> buildlib.win-amd64-cpython-311lxmlhtml
      creating buildlib.win-amd64-cpython-311lxmlisoschematron
      copying srclxmlisoschematron__init__.py -> buildlib.win-amd64-cpython-311lxmlisoschematron
      copying srclxmletree.h -> buildlib.win-amd64-cpython-311lxml
      copying srclxmletree_api.h -> buildlib.win-amd64-cpython-311lxml
      copying srclxmllxml.etree.h -> buildlib.win-amd64-cpython-311lxml
      copying srclxmllxml.etree_api.h -> buildlib.win-amd64-cpython-311lxml
      copying srclxmlincludesc14n.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesconfig.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesdtdvalid.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesetreepublic.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludeshtmlparser.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesrelaxng.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesschematron.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludestree.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesuri.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesxinclude.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesxmlerror.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesxmlparser.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesxmlschema.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesxpath.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesxslt.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludes__init__.pxd -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludesetree_defs.h -> buildlib.win-amd64-cpython-311lxmlincludes
      copying srclxmlincludeslxml-version.h -> buildlib.win-amd64-cpython-311lxmlincludes
      creating buildlib.win-amd64-cpython-311lxmlisoschematronresources
      creating buildlib.win-amd64-cpython-311lxmlisoschematronresourcesrng
      copying srclxmlisoschematronresourcesrngiso-schematron.rng -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesrng
      creating buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsl
      copying srclxmlisoschematronresourcesxslRNG2Schtrn.xsl -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsl
      copying srclxmlisoschematronresourcesxslXSD2Schtrn.xsl -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsl
      creating buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsliso-schematron-xslt1
      copying srclxmlisoschematronresourcesxsliso-schematron-xslt1iso_abstract_expand.xsl -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsliso-schematron-xslt1
      copying srclxmlisoschematronresourcesxsliso-schematron-xslt1iso_dsdl_include.xsl -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsliso-schematron-xslt1
      copying srclxmlisoschematronresourcesxsliso-schematron-xslt1iso_schematron_message.xsl -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsliso-schematron-xslt1
      copying srclxmlisoschematronresourcesxsliso-schematron-xslt1iso_schematron_skeleton_for_xslt1.xsl -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsliso-schematron-xslt1
      copying srclxmlisoschematronresourcesxsliso-schematron-xslt1iso_svrl_for_xslt1.xsl -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsliso-schematron-xslt1
      copying srclxmlisoschematronresourcesxsliso-schematron-xslt1readme.txt -> buildlib.win-amd64-cpython-311lxmlisoschematronresourcesxsliso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating buildtemp.win-amd64-cpython-311
      creating buildtemp.win-amd64-cpython-311Release
      creating buildtemp.win-amd64-cpython-311Releasesrc
      creating buildtemp.win-amd64-cpython-311Releasesrclxml
      "C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.32.31326binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrclxmlincludes -IC:UsersmarcuAppDataLocalProgramsPythonPython311include -IC:UsersmarcuAppDataLocalProgramsPythonPython311Include "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.32.31326ATLMFCinclude" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.32.31326include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" /Tcsrclxmletree.c /Fobuildtemp.win-amd64-cpython-311Releasesrclxmletree.obj -w
      cl : Command line warning D9025 : overriding '/W3' with '/w'
      etree.c
      C:UsersmarcuAppDataLocalProgramsPythonPython311includepyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
      Compile failed: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe' failed with exit code 2
      creating Users
      creating Usersmarcu
      creating UsersmarcuAppData
      creating UsersmarcuAppDataLocal
      creating UsersmarcuAppDataLocalTemp
      "C:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.32.31326binHostX86x64cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I/usr/include/libxml2 "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.32.31326ATLMFCinclude" "-IC:Program FilesMicrosoft Visual Studio2022CommunityVCToolsMSVC14.32.31326include" "-IC:Program Files (x86)Windows KitsNETFXSDK4.8includeum" /TcC:UsersmarcuAppDataLocalTempxmlXPathInit65mzfy1g.c /FoUsersmarcuAppDataLocalTempxmlXPathInit65mzfy1g.obj
      xmlXPathInit65mzfy1g.c
      C:UsersmarcuAppDataLocalTempxmlXPathInit65mzfy1g.c(1): fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
      error: command 'C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x64\cl.exe' failed with exit code 2
      *********************************************************************************
      Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
      *********************************************************************************
      [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.
╰─> lxml

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

I am using python 3.11.0, and the command I am using to install pandas datareader is "pip install pandas-datareader" Thanks for the help!

It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.
It looks like your post is mostly code; please add some more details.

2

Answers


  1. try:

    pip install –upgrade pip

    On Windows the recommended command is:

    python -m pip install –upgrade pip

    Login or Signup to reply.
  2. You’re almost there. Check the error logs carefully. You’ll notice it’s asking for:

    Is libxml2 installed?
    

    Try installing that with pip then retry.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search