ImportError: No module named mcpi.minecraft

8,519 views
Skip to first unread message

Mark Elliott

unread,
Jul 26, 2015, 9:35:38 AM7/26/15
to Adventures in Minecraft Forum
As a middle aged luddite hoping to inspire his son some help would be appreciated. Struggled with lesson one, appeared to run fine on python shell and bukkit but message wouldn't show on Minecraft (I'm using the correct version) aware that something isn't right I pushed on to lesson two; that too failed but I got this message and am wondering if it's highlighting a more fundamental error to my set up: 


Original code:

import mcpi.minecraft as minecraft
mc = minecraft.Minecraft.create()
pos = mc.player.getTilePos()
print (pos.x)
print (pos.y)
print (pos.z)

Produced this result in the python shell:

Traceback (most recent call last):
  File "C:/Users/mark/Desktop/AdventuresInMinecraft/whereAmI.py.", line 1, in <module>
    import mcpi.minecraft as minecraft
ImportError: No module named mcpi.minecraft

Any guidance would be genuinely appreciated....




Martin O'Hanlon

unread,
Jul 27, 2015, 3:51:58 AM7/27/15
to Adventures in Minecraft Forum, markell...@gmail.com
Hi Mark,

Im sure we can help, in many respects Chapter 1 can be the most troublesome, getting everything setup for any programming task can be a challenge.

It sounds like you have successfully installed the StarterKit and Python and have managed to connect to your Bukkit server?  Great.

Have you saved your programs in the MyAdventures folder? 

The error you are getting is Python telling you that it cant find the minecraft api module which is in the mcpi folder in the MyAdventures folder.

If you have, can you see the mcpi folder in the MyAdventures folder? Could you perhaps send a screenshot which shows the contents of the MyAdventures folder and your program in it?

Let us know how you get on.

Martin

Adventures in Minecraft Forum

unread,
Jul 28, 2015, 1:54:58 PM7/28/15
to Adventures in Minecraft Forum, mar...@ohanlonweb.com
HI Martin, Thanks for the response, I've yeah successfully installed the StarterKit and Python and have managed to connect to your Bukkit server and yes I've saved the programmes to My Adventures Folder, as requested I've attached two screenshots of the relevant folders.

any guidance is appreciated!

thanks

Mark 




Martin O'Hanlon

unread,
Jul 28, 2015, 2:00:51 PM7/28/15
to Adventures in Minecraft Forum, adventures-in-...@googlegroups.com
Hi Mark,

Thanks for the info, its really useful.

So the whereami program is giving you an error because it cant find the mcpi folder. If you move it into the MyAdventures folder it should run. 

The starter kit is built so that everything you need to complete the projects is in the MyAdventures folder so you should save all your programs to there.

As to why HelloMinecraftWorld didnt work is a different issue as that is in the correct MyAdventures folders. The one thing which does come to mind is that when your program puts a message on the screen in Minecraft it only stays there for 10 seconds, so if your not quick switching to the Minecraft window after running your program its easy to miss it. Did any errors appear when you ran the program?

Let me us know how you get on.

Martin


Mark Elliott

unread,
Jul 30, 2015, 1:46:35 PM7/30/15
to Adventures in Minecraft Forum, mar...@ohanlonweb.com
Hi Martin, 

Thanks for the help, Lesson one for whatever reason isn't working, however, lesson two did! so thanks for the help, On we go.

thanks again

Emlyn Soppa

unread,
Nov 2, 2017, 1:53:16 PM11/2/17
to Adventures in Minecraft Forum
hi guys nothing works

Martin O'Hanlon

unread,
Jan 5, 2018, 3:07:07 PM1/5/18
to Adventures in Minecraft Forum
Hi Emlyn,

I just came across your post hiding in here. Can you elaborate? Do you receive a particular error? Are you struggling with the install? If its helpful there are videos available which talk you through the install process.

Let me know if I can help.

Martin

Jack Beefree

unread,
Feb 10, 2018, 10:55:24 PM2/10/18
to Adventures in Minecraft Forum
Hello Mark Elliott.

 It's the same problem I had. but I discovered that mcpi does not appear in my / Documents / Minecraft Python / Minecraft Tools.

put the file I send in the above folder (I use Windows 10 and find this error today when reading your problems).

The mcpi file appear when I unzip (minecraftPythonAPI.zip)in the same folder / Documents / Minecraft Python / Minecraft Tools.

And voila the show must go on......  I think is too late this question but can help us.


 Good bye.
minecraftPythonAPI.zip
Files.jpg

K3WL DERP

unread,
Apr 14, 2019, 8:12:30 PM4/14/19
to Adventures in Minecraft Forum
hello this is 2019 so this might be outdated but when I try to run "Install_API.bat" it opens cmd with an error 'python' is not recognized as an internal or external command, operable program or batch file. and I'm also on windows 10 so that might be the case
Capture5.PNG

Andrew Kircher

unread,
Jun 23, 2019, 9:40:35 PM6/23/19
to Adventures in Minecraft Forum
I Right clicked on the "Install_API.bat" then went to edit and the changed the code to. 

py -3 -m pip install minecraftPythonAPI.zip
pause

Cory Eicher

unread,
Jan 12, 2020, 7:43:52 PM1/12/20
to Adventures in Minecraft Forum
We had the same error on Windows 10. We were able to fix by 1) installing PIP (https://pip.pypa.io/en/stable/installing/). Then 2) running this:

pip install mcpi

After this we were able to complete Adventure 1.

We're using Python 3.4 FWIW.

-Cory
Reply all
Reply to author
Forward
0 new messages