5

I just build a pc and I have been trying to install matplotlib on it using pip, but for some reason I keep getting this error

Command "python setup.py egg_info" failed with error code 1

I am on windows 10, using python 2.7 and I use

pip install matplotlib

Has this happened to anyone else, and what do I need to do to fix it? It also does this when I try to install pandas as well.

Thanks!

dumbledad
  • 16,305
  • 23
  • 120
  • 273
AlpinistGuy
  • 71
  • 1
  • 1
  • 4
  • what versio of pip? check your pip version with `pip -v` – Prakash Palnati Jan 26 '18 at 05:38
  • In the future, please ensure you [research your problems thorough](https://meta.stackoverflow.com/q/261592/1394393) before posting a question. Had you Googled the error, you probably would have found the answer yourself. Additionally, be sure you include all the details necessary for someone to help diagnose your problem. You don't tell us what version of Python. You don't tell us your OS. You don't tell us the command you used. These pieces of information are vital to understanding the potential causes. – jpmc26 Jan 29 '18 at 08:45
  • I cannot answer now, as this is marked as a duplicate, but I had the same issue and none of the answers helped. What worked for me was to choose an earlier version. Matplotlib's version as I type is 3.0.0 but this works: `pip install matplotlib==2.2.3` – dumbledad Sep 19 '18 at 12:16
  • It's also worth noting that with wheels the installation should not be attempting to build from source, in my case the error was missing wheels and so it is worth reporting the error as a issue on the package repository (like I did [here](https://github.com/matplotlib/matplotlib/issues/12169)) – dumbledad Sep 19 '18 at 14:38

1 Answers1

12

You might not have installed setuptools correctly, or it may not be upgraded. Try this first

pip install --upgrade setuptools

And then, try with pip, or sometimes pip2/3 also might work.

pip install matplotlib
pip2 install matplotlib

On another note, you should really try to search your error before you post a question, since this has happened before, Python pip install gives "Command "python setup.py egg_info" failed with error code 1"

ThunderFlash
  • 412
  • 5
  • 20
  • 4
    Don't answer unclear questions without enough info to answer them. And if something is a dupe, flag it instead of answering. – jpmc26 Jan 26 '18 at 05:48
  • 9
    this is a pretty clear issue, if you read the link, I don't see why you'd downvote a re-direct to a helpful post? Its op's first post on this forum and i'm sure you didn't read all the rules when you first made an account did you? – ThunderFlash Jan 26 '18 at 05:52
  • https://meta.stackoverflow.com/q/362473/1394393 – jpmc26 Jan 26 '18 at 06:09
  • There's a lot of different possible reasons why it failed. All we can really say is that the user tried to install matplotlib and it failed because the attempt to build the native binary component failed. This doesn't make a lot of sense since matplotlib [distributes wheels now](https://pypi.python.org/pypi/matplotlib), meaning the binary build should be unnecessary. So any number of things could be going on. I probably should've voted to close as Unclear instead of duplicate. – jpmc26 Jan 26 '18 at 06:15
  • 2
    Thanks for the help and not being such a stick in the mud!!! – AlpinistGuy Jan 27 '18 at 16:48
  • 10
    Some people think they can be big-headed in the forums because they think they know so much, if only @jpmc26 read this he would understand what I'm saying https://stackoverflow.com/help/be-nice . Pay close attention to the rule where it says be nice to new users, be welcoming. I hope I don't have to explain what this means to you. This forum is to help people, you call it spoonfeeding? – ThunderFlash Jan 29 '18 at 04:26
  • 3
    @ThunderFlash I may have been too harsh, but SO has a serious problem with poorly researched questions. SO is here to help people, but not on any terms they want. SO is designed to provide a specific kind of help: it is designed to aid you [when you hit a wall in your own research](https://meta.stackoverflow.com/a/261593/1394393). The OP here shows no signs of engaging in their own research. Even a Google search was more than they were willing to do. We do not want such questions answered because rewarding them tends to draw even more, eventually drowning out good questions (Slashdot effect). – jpmc26 Jan 29 '18 at 08:40
  • @ThunderFlash I've replaced my comment on the question with a more neutral one. Thank you. – jpmc26 Jan 29 '18 at 08:46