I am trying to install Pandas in Pycharm using pip
(pip install pandas
) and I get the following error:
Collecting pandas
Using cached pandas-2.1.4.tar.gz (4.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 2
╰─> [48 lines of output]
+ meson setup C:UserskarrasAppDataLocalTemppip-install-vibg7f38pandas_61d0262f7482412ca98548131df7fc12 C:UserskarrasAppDataLocalTemppip-install-vibg7f38pandas_61d0262f7482412ca98548131df7fc12.mesonpy-zms6t414build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --vsenv --native-
file=C:UserskarrasAppDataLocalTemppip-install-vibg7f38pandas_61d0262f7482412ca98548131df7fc12.mesonpy-zms6t414buildmeson-python-native-file.ini
Traceback (most recent call last):
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildmesonmain.py", line 194, in run
return options.run_func(options)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildmsetup.py", line 358, in run
app.generate()
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildmsetup.py", line 183, in generate
return self._generate(env, capture, vslite_ctx)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildmsetup.py", line 205, in _generate
intr = interpreter.Interpreter(b, user_defined_options=user_defined_options)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterinterpreter.py", line 330, in __init__
self.parse_project()
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterbaseinterpreterbase.py", line 134, in parse_project
self.evaluate_codeblock(self.ast, end=1)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterbaseinterpreterbase.py", line 190, in evaluate_codeblock
raise e
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterbaseinterpreterbase.py", line 182, in evaluate_codeblock
self.evaluate_statement(cur)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterbaseinterpreterbase.py", line 196, in evaluate_statement
return self.function_call(cur)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterbaseinterpreterbase.py", line 521, in function_call
res = func(node, func_args, kwargs)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterbasedecorators.py", line 277, in wrapper
return f(*nargs, **wrapped_kwargs)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterbasedecorators.py", line 596, in wrapper
return f(*wrapped_args, **wrapped_kwargs)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildinterpreterinterpreter.py", line 1308, in func_project
mesonlib.setup_vsenv(force_vsenv)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildutilsvsenv.py", line 118, in setup_vsenv
return _setup_vsenv(force)
File "C:UserskarrasAppDataLocalTemppip-build-env-a55wpluzoverlayLibsite-packagesmesonbuildutilsvsenv.py", line 57, in _setup_vsenv
bat_json = subprocess.check_output(
File "C:UserskarrasAppDataLocalProgramsPythonPython310-32libsubprocess.py", line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "C:UserskarrasAppDataLocalProgramsPythonPython310-32libsubprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe', '-latest', '-prerelease', '-requiresAny', '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', '-requires', 'Microsoft.VisualStudio.Workload.WDExpress', '-products', '*', '
-utf8', '-format', 'json']' returned non-zero exit status 87.
The Meson build system
Version: 1.2.1
Source dir: C:UserskarrasAppDataLocalTemppip-install-vibg7f38pandas_61d0262f7482412ca98548131df7fc12
Build dir: C:UserskarrasAppDataLocalTemppip-install-vibg7f38pandas_61d0262f7482412ca98548131df7fc12.mesonpy-zms6t414build
Build type: native build
Project name: pandas
Project version: 2.1.4
....meson.build:2:0: ERROR: Unhandled python exception
This is a Meson bug and should be reported!
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Any ideas about what is wrong?
2
Answers
Finally i reported the Meson bug, the error was due to outdated vswhere.exe that meson is not handling it gracefully. Updating the Microsoft VS and choosing specific pandas version (pip install pandas==2.0.3) i managed to install pandas.
Just as @tripleee mentioned, your error message says ‘This is a Meson bug and should be reported!’. You can report the bug here and also search for your specific error message " ….meson.build:2:0: ERROR: Unhandled python exception" to see possible solutions to similar issues.