0

I am having this issue when running my code in PyCharm. other of my codes where I don't import pandas or NumPy work fine.

I have tried the suggested solution in this previous question in my terminal:

pip install --user --force-reinstall --ignore-installed --no-binary :all: pandas

But I get the following error:

ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly

I am stock and don't know what to do from here.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Gerson
  • 1
  • 1
  • I think that was a bad advice (for several reason: the answer doesn't tell why it works (so just random try and error); `--force` is often a bad thing if you do not know what you are doing (see point 1); and it is not a solution (forcing pip instead of conda, so you are not really solving anything, just hiding the real error which later will come (for sure) and much worse (you have a bad environment). In any case: are you using conda? If you install a new conda environment, do you have the same error? Do you have error on updates? How did you install originally python and pandas? – Giacomo Catenazzi Apr 28 '21 at 14:48
  • 1
    Thanks for the insight, I agree that they give a solution and don't say why it works. (I guess I followed it because is the only solution I saw online). Thanks to your questions, I was able to figure things out and my problem is fixed. The versions of numpy and pandas in my conda environment were not up to date, and it was causing this error. jus updated the versions in the environment and all works fine – Gerson Apr 28 '21 at 15:16
  • 1
    Please answer your own question (it is allowed in this site). This will help people to find a better solution, before being redirected to the other question, – Giacomo Catenazzi Apr 28 '21 at 15:42

1 Answers1

0

Thanks to some comments above, I managed to find the solution.

First thing, I opened other projects where I import pandas and numpy. I ran one of the codes and all worked.

Then I compare the versions of the libraries (numpy and pandas) between environments. The versions of the environment I was having issues were not up to date. So I went to the terminal, I activate the environment with the problem and I installed the same versions in other environments

pip install numpy==1.19.5
pip install pandas==1.1.5
Dharman
  • 30,962
  • 25
  • 85
  • 135
Gerson
  • 1
  • 1