9

I'm trying to install pandas via pip install pandas on my laptop.

Environment:

  • Window 11 Pro
  • Python 3.10.4
  • Pip version 22.0.4

Compatibility:

C:\Users\PC>pip install pandas
WARNING: Ignoring invalid distribution -ywin32 (c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages)
WARNING: Ignoring invalid distribution -ywin32 (c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages)
Collecting pandas
  Using cached pandas-1.4.2.tar.gz (4.9 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy>=1.21.0 in c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages (from pandas) (1.22.4)
Requirement already satisfied: python-dateutil>=2.8.1 in c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages (from pandas) (2.8.2)
Collecting pytz>=2020.1
  Using cached pytz-2022.1-py2.py3-none-any.whl (503 kB)
Requirement already satisfied: six>=1.5 in c:\users\pc\appdata\local\programs\python\python310-32\lib\site-packages (from python-dateutil>=2.8.1->pandas) (1.16.0)
Building wheels for collected packages: pandas
  Building wheel for pandas (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pandas (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [2010 lines of output]
      C:\Users\PC\AppData\Local\Temp\pip-build-env-q3kdt5nb\overlay\Lib\site-packages\setuptools\config\setupcfg.py:459: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
        warnings.warn(msg, warning_class)

...

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

What I have tried:

  • updated pip to 22.1.1
  • installed wheel 0.37.1
  • uninstalled and installed pip
  • uninstalled and installed python 3.10.4

Error still reproducible with pandas 1.5.1


Thanks to @AKX which has pointed up that there is no and may will no 32-bit version of pandas in the future. See the discussion on GitHub.

Thingamabobs
  • 7,274
  • 5
  • 21
  • 54
  • try `pip install manager` then `*pip install pandas*` - [where I found this](https://learn.microsoft.com/en-us/answers/questions/96580/question-about-installing-pandas-in-python.html) – taylorSeries May 27 '22 at 06:45
  • 1
    @PrestigeDev thanks for your advise, but I ran into a different error to install this package `error: metadata-generation-failed`. Im trying to install scipy now. If I have similar issues I'll try to reinstall python. – Thingamabobs May 27 '22 at 06:52
  • 1
    I would use Anaconda if that doesn't work – taylorSeries May 27 '22 at 06:53
  • 2
    "The easiest way to install pandas is to install it as part of the Anaconda distribution, a cross platform distribution for data analysis and scientific computing." - [pandas - Installation](https://pandas.pydata.org/docs/getting_started/install.html) – taylorSeries May 27 '22 at 09:18
  • 3
    @PrestigeDev I do not like the idea of being forced to use anaconda for pandas. If there was not a regular way with PyPi I would agree and its a normal condition, but since it does not explicitly state it is necessary I would like to have it work. :D But thank you for your time and effort to solve my issue. – Thingamabobs May 27 '22 at 09:45

3 Answers3

5

Pandas doesn't require Anaconda to work, but based on python310-32 in your output, you're using a 32-bit build of Python.

Pandas evidently does not ship 32-bit wheels for Python 3.10 (they do have win32 wheels for Python 3.8 and Python 3.9 though). (There could be alternate sources for pre-built 32-bit wheels, such as Gohlke's site.)

In other words, on that platform you would need to install Pandas from source, which will likely be a rather difficult undertaking, and can't be done directly within pip anyway (as you noticed via error: metadata-generation-failed).

If your system is capable of running 64-bit Python, you should switch to it.

AKX
  • 152,115
  • 15
  • 115
  • 172
  • First of all, thanks for clearing this up. Could you please elaborate why I shouldn't wait for a 32-bit wheel, rather than switching to 64-bit python? As far as I know it is just important for extensive memory usage. – Thingamabobs Nov 01 '22 at 14:32
  • I don't think there will be a 32-bit wheel (it would have been uploaded along with the other wheels), so you'd wait for a long time. – AKX Nov 01 '22 at 14:38
  • [They seem to hesitate with it](https://github.com/pandas-dev/pandas/issues/44453) – Thingamabobs Nov 01 '22 at 14:46
  • :shrug: Well, judging by the timestamps on that issue you'll _still_ be waiting for a long time for them to finish hesitating. – AKX Nov 01 '22 at 14:48
  • lmao, yes. I'm not in hurry. Though, I will need it in the future again. – Thingamabobs Nov 01 '22 at 14:50
  • It would be easier to just go with 64-bit Python. Is there a reason for you to stick with 32-bit? – AKX Nov 01 '22 at 14:53
  • No particular, no. But I remember some other technologies I have used in the past wasn't available in 64-bit. That's why I had switched from 64-bit to 32-bit in the first place. I rather thought about starting to use virtual environments so I will be more flexible in the future and maintain both for my projects. – Thingamabobs Nov 01 '22 at 14:57
  • 1
    You should _always_ use virtualenvs-per-project anyway. I would still recommend switching over to 64-bit – if there are things that don't work in 64-bit, shame on them... – AKX Nov 01 '22 at 15:04
4

Install pandas in Python 3.10

python -m pip install pandas
vimuth
  • 5,064
  • 33
  • 79
  • 116
2

Step one

Download pandas wheel, Choose one that suits your operating system

Step two

install the wheel from absolute path

pip install pandas-1.4.2-cp310-cp310-win32.whl

Step three

You had successful installed pandas Check it

import pandas
wang jiaxi
  • 21
  • 1