No module named mcpi minecraft ошибка что делать

Обновлено: 03.07.2024

I have recent acquired the book adventures in Minecraft and want to give it a try on my Mac. I follow the instructions until it tells me to type this code into my python 2.7:

I keep receiving a error stating that no module named mcpi.minecraft exists. I checked the folder that stores my program and it does have an mcpi folder. Does anybody have the solution?


5,827 11 11 gold badges 27 27 silver badges 41 41 bronze badges

3 Answers 3

I had the same issue. I ended up not even using IDLE. I just write the commands into a separate terminal window form the one I am running the server on.

I have not written any scripts yet and tried to run them in this way but I am sure it works.

If you use the terminal rather than IDLE (like me) I would pip install mcpi


2,855 11 11 gold badges 20 20 silver badges 26 26 bronze badges Please add further details to expand on your answer, such as working code or documentation citations.

I also decided to read this book and faced the same problem. You just need to save the file by the path: / AdventuresInMinecraft / MyAdventures here you save your file.


A ConnectionRefusedError means that the address + port combination was unable to be secured for this particular Minecraft server and thus raised an exception. This could be because some other application is already using the port of interest, the port is unavailable because of the OS, or a handful of other networking configuration mishaps.

But perhaps a better series of questions to ask yourself is:

  • What is the default address and port that minecraft.Minecraft.create() will attempt to launch / listen at?
  • Do I have access to that server (address + port)?
  • If I do have access, are there any security issues (AKA Firewall)?

This post has already addressed the root issue of your question, and I hope it gives you a good start at understanding the foundation of your problem.

Notice how their question mentions s.connect((host,port)) and your stack trace has self.socket.connect((address, port)) Looks like the same thing to me!


I encountered the same issue. I looked into the code of mcpi and found that the default port is 4711. However, a Minecraft Server's default port is 25565. All you need to do is add 2 parameters on the create() function. Code(Python):

btw change "address" in the code to the host of the server (only if you modified the "server.properties" file).

Also, ConnectionRefusedError doesn't mean that it's not secured, I believe it means that either the server is not online, it doesn't exist, or the server refused it for some reason.

EDIT: Oops sorry I just found out that mcpi actually connects to the RaspberryJam plugin which is hosted on another IP and port. The plugin runs on port 4711. So mcpi has the right port. So check if you have the RaspberryJam plugin installed. If not, download it from

And put the .jar file inside the plugins folder in your server directory.

5fb01d40af871198482935.jpg


Файл находит и подключает, но работает некорректно, не работают подсказки объявленных переменных.
Постоянно выводит ошибку - No module named.Stock: 1
Файлы находятся в одной папке

Или сам скрипт не там лежит, или модуль/пакет, или не с той директории запускаете.

Я не вижу в табе "Project" ни запускаемого файла, ни модуля/пакета. Покажите полную структуру проекта, Run/debug configuration, ну чтобы два раза не спрашивать Properties->Project->Project Structure.
Написано только что

5fb3fd3256c77204329972.jpg

5fb3fe92b3f45868370266.jpg

ednichivorov, Что-то у вас второй каталог .idea в поддиректории виден. И каталог Objects, где ваши файлы лежат (и откуда запускаются), не отмечен, как Sources.

File "C:/Users/mark/Desktop/AdventuresInMinecraft/whereAmI.py.", line 1, in <module>

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?

Adventures in Minecraft Forum



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?

Читайте также: