can't compile, "no module named yaml"


Questions, Explanations, Howtos

Temple Termagant

Posts: 5

Joined: Monday, 16th March 2015, 11:12

Post Saturday, 16th November 2019, 16:17

can't compile, "no module named yaml"

Hello! I'm trying to build crawl on windows 7, following step-by-step the instructions from "Building on Windows (MSYS2)" section in the INSTALL.txt. However, when doing Make, I get "No module named 'yaml'". I did install yaml as per instructions before; running "pip install pyyaml" returns "Requirement already satisfied: pyyaml in d/msys64/mingw64/lib/python3.8/site-packages (5.1.2)". But trying to verify installation by "python -m yaml" tells me "no module named yaml", same as when making.

What am I doing wrong?

Dungeon Master

Posts: 338

Joined: Monday, 18th August 2014, 20:04

Post Saturday, 16th November 2019, 19:13

Re: can't compile, "no module named yaml"

Are you sure that the version of pip you are calling matches the version of python that is first in the path? Often a situation like this happens when e.g. `python` is calling python 2, but `pip` (as the message indicates) is calling python 3, or vice versa. The INSTALL.txt instructions are written on the assumption that only (one version of) python 3 is installed.

Temple Termagant

Posts: 5

Joined: Monday, 16th March 2015, 11:12

Post Sunday, 17th November 2019, 11:24

Re: can't compile, "no module named yaml"

...Despite following instructions to the letter, there are apparently two version of python: python and python3 are 3.7.4, and python3.8 is 3.8.0. The latter one seems to see yaml installed.

How do I get crawl to compile with python 3.8?

Dungeon Master

Posts: 338

Joined: Monday, 18th August 2014, 20:04

Post Sunday, 17th November 2019, 14:58

Re: can't compile, "no module named yaml"

It looks like msys2 very recently updated the `python3`-labeled packages to be 3.8; not sure where the 3.7 version was coming from but if you didn't just install msys2 for these purposes, it might have been lingering. (Or it might even be the current default python version on new MSYS2 versions, which would be confusing.) I would start by trying to explicitly install/reinstall the package `mingw-w64-x86_64-python3`, which is python 3.8, and should explicitly install `python.exe` in the right place. I'm not sure if msys2 has a way of switching between different versions of something like python (many package managers do), so you may need to do that. You might also try uninstalling 3.7?

Temple Termagant

Posts: 5

Joined: Monday, 16th March 2015, 11:12

Post Monday, 18th November 2019, 16:02

Re: can't compile, "no module named yaml"

I did indeed install msys2 just for the purpose of building crawl, and it does indeed seem that the default python version is still 3.7, since reinstalling python package did nothing. Lacking experience in operating this, I wasn't particularly successful in getting it to use 3.8...

...so after some time I decided to just manually install yaml into python 3.7, which proved to be significantly easier.

Return to Coding

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.