Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named yaml (brew broke my python, again)

homebrew has again broken python for about third time. Im now having issues getting dependencies to work again. At this point I am unable to install yaml.

Collecting yaml Could not find a version that satisfies the requirement yaml (from versions: ) No matching distribution found for yaml

Some other suggestions have said to try pyaml, which again simply tries to import yaml and fails Traceback (most recent call last): File "script.py", line 13, in <module> import pyaml File "/~/virtualenv/project/lib/python2.7/site-packages/pyaml/__init__.py", line 6, in <module> import os, sys, io, yaml ImportError: No module named yaml

Anyone have an idea how to get this sorted out?

like image 371
Vinnie James Avatar asked Sep 15 '25 19:09

Vinnie James


1 Answers

There are two packages with somewhat unfortunate naming in the Python Package Index.

  • pip install pyyaml lets you import yaml. This package enables Python to parse YAML files.
  • pip install pyaml lets you import pyaml. This package allows pretty-printing of YAML files from Python, among other things. It requires pyyaml to be installed.

So the way forward for you is:

  1. Install pyyaml, preferably using pip
  2. Install pyaml
  3. Profit

Step 0 would be to run everything from a virtual environment to prevent homebrew from messing with your Python ever again. This option also lets you run multiple versions of Python, not just the one required by homebrew.

like image 83
mpenkov Avatar answered Sep 18 '25 08:09

mpenkov