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

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

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.

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

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

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

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

File «C:/Users/mark/Desktop/AdventuresInMinecraft/whereAmI.py.», line 1, in

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?

Источник

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

Hi, total Pi noob here.

Recently got a Pi B kit with an SD card already set up with Rasbian so my son can learn a little programming with Python. It’s a great little bit of kit and we are really excited to set off on this path of learning. The resources available are great and so appreciated.

So far it’s been good, teaching the basics of set up and running Rasbian and some Unix command line stuff. Today though we tried to do the first Minecraft lesson and were stumped right off the bat.

We were able to run and play Minecraft, obviously came pre installed on the card. Great. But when we got to run the first line of Python code in the lesson we got an error. After snooping around its obvious there is no mcpi folder in the home folder and I cannot find any instance of the Minecraft app.

So why, and how do I get it? Do I need to download a special programming version of MC? I am not set up with network access on the Pi yet. Without it I guess I’m out of luck at this point?

Thanks for any advice
AdamM

Re: Minecraft Pi installed, but no mcpi folder

I think you might be following an outdated tutorial.

(There will not be an mcpi folder in your home directory unless you choose to create one. If you are able to run and interact with MineCraft then it is clearly installed.)

Re: Minecraft Pi installed, but no mcpi folder

Take a look at the Xmas edition of The MagPi Magazine there’s six pages on getting Minecraft running on the Pi (and it was updated for the «pre-installed» version before that edition of the mag was published).

Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors — are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Re: Minecraft Pi installed, but no mcpi folder

B.Goode wrote: I think you might be following an outdated tutorial.

(There will not be an mcpi folder in your home directory unless you choose to create one. If you are able to run and interact with MineCraft then it is clearly installed.)

Thanks for the reply. That is exactly the tutorial I was following. I entered the first line of code and got an error. I’m not near the Pi now so I can’t check the exact verbiage of the error. I did some reading trying to find a solution and came across the ‘stuffaboutcode’ website. There I read that there should be an mcpi folder and I needed to copy some files from it.

Now I’m really stumped

Re: Minecraft Pi installed, but no mcpi folder

Re: Minecraft Pi installed, but no mcpi folder

Re: Minecraft Pi installed, but no mcpi folder

DougieLawson wrote: Take a look at the Xmas edition of The MagPi Magazine there’s six pages on getting Minecraft running on the Pi (and it was updated for the «pre-installed» version before that edition of the mag was published).

Another fantastic learning resource for the Pi. Amazing. I will read through it and see how far I get

Re: Minecraft Pi installed, but no mcpi folder

Great reply. Thanks for the details. Yes that’s exactly what I was entering into IDLE 3. I read somewhere else that the Minecraft API needed to be copied into the mcpi and I assumed that it was a directory. Makes sense now.

I noticed you were using a shell. I will try that.
Thx so much

Re: Minecraft Pi installed, but no mcpi folder

Okay, still no luck and started to really ticked off. This is supposed to be easy for teachers and kids. I’ve followed numerous basic beginner lessons over the past two weeks and none of them yield anything close to the correct result.

Читайте также:  Wordpress support ticket system

I am not an idiot, I know it’s not me. I’ve used computers for almost 30 years. While not a programmer, I know my way around the command line and how to self teach. I repeat, I’m not an idiot. This should be easier.

None of the advice in previous replies above works. None. I’ve followed it to the character. If I can’t get past step one then this whole idea is a complete waste of time.

Please look at the screen images I posted to see exactly what I’m typing and the error messages I get. There is still no mcpi folder and there absolutely unequivocally should be.

Can someone please please please offer some advice that will get me on my way.

Re: Minecraft Pi installed, but no mcpi folder

Are you running Python 3 or Python 2. We started with 3 and saw the same error message. We switched to Python 2 and it worked!

I hope that helps.

Re: Minecraft Pi installed, but no mcpi folder

> There is still no mcpi folder and there absolutely unequivocally should be.

There is no «mcpi» folder in the home directory /home/pi/ on my RPi 2 with current Raspbian installed, but despite that fact, this tutorial
https://www.raspberrypi.org/learning/ge . worksheet/ does work for me as expected. If it is not working for you then there must be some other cause for the problem.

Your second screenshot shows a Python error that «no module named mcpi» (note- «module» not «folder»). That means the Python module «mcpi» is not installed. To fix this, you can update your Raspbian install to the current version. You can do that with

assuming the Pi is connected to the internet. I don’t know how to fix it without having the Pi connected to the internet, except by moving it somewhere that you can connect.

If you believe you have a fully updated version, please report the result of typing at the shell prompt:

Re: Minecraft Pi installed, but no mcpi folder

With apologies for having referred you to the Raspberry Pi Foundation tutorial which I assumed would be reliable, I think there might be a small — but significant — error therein.

It clearly instructs you to use the Python3 entry, which runs the IDLE3 IDE for you, which relies on the python3.2.3 interpreter.

The installed python mcpi module requires to be accessed from python2. You can do this by using the Python entry, which runs the IDLE IDE instead.

On the assumption that this is an error in documentation I have raised it as an Issue with the maintainers of the documentation. https://github.com/raspberrypilearning/ . /issues/14

Re: Minecraft Pi installed, but no mcpi folder

Thanks much folks for the replies. After a lot of headbanging and digging around the ‘net I found out that in earlier versions of MC that did not come pre installed there was an mcpi folder where all the API files were located. It took forever to realize that things are much different I later versions that come pre installed.

And I found several different methods of initiating the lesson (loading the classes, connecting to the server etc), which confused the issue even more.

Also, yes several tutorials I found stated Python 3 should be used, until I found one that mentioned using Python 2. I tried that and everything worked as expected.

There have been a few hiccups along the way. Some of the code in the Foundation lesson did not work for me (x, y, z position variables for instance) but I was able to workaround by declaring them individually. No worries.

So I was able to work thorough the lesson and then teach it to some 11 yr olds who loved it. Boning up on the next class. Just trying to stay a half step ahead.

So lesson learned, its confusing when things change and you are chasing outdated info. Would be really nice if those who wrote the lessons were able to update the post to mention this is no longer valid. Especially when they have gone to the trouble to write further lessons that are more current. Unfortunately Google is not yet smart enough to discern between the two. Anyhow that’s neither here nor there and probably too much to wish for anyway.

Thanks again
Adam

Re: Minecraft Pi installed, but no mcpi folder

Re: Minecraft Pi installed, but no mcpi folder

We added Python 3 support a couple of months ago. Run

«`bash
sudo apt-get update
sudo apt-get upgrade
«`

from the Terminal and you’ll have the Python 3 version too.

Re: Minecraft Pi installed, but no mcpi folder

Thank you for the reply. I’m glad my rant was in some small way a little help. I wish I was able to help more, I’m such a beginner too as I stumble my way through learning this platform.

It is a shame, but somewhat understandable considering the state of flux something as new and developing as this area of computing. In which case I think it needs special attention, by those reporting or developing resources for, to keep the flow of information in the right direction. Outdated info helps no one in the end. Inconsistent advice will only put off new arrivals to the game.

Читайте также:  Когда печорин видит бэлу он захотел ее украсть где ошибка

I wish you the best of luck as you push forward with your learning. I must say once I got over the initial set of frustrations, I have been enjoying playing around with it. My students even completed their first game programmed in minecraft last week, an exercise from the stuffaboutcode site. Very satisfying to see progress as last. I hope we can continue in this manner.

Re: Minecraft Pi installed, but no mcpi folder

ben_nuttall wrote: We added Python 3 support a couple of months ago. Run

«`bash
sudo apt-get update
sudo apt-get upgrade
«`

from the Terminal and you’ll have the Python 3 version too.

I’ll stop short of saying this isn’t true, you may very well have added support for Python 3. However the lessons that call for Python 3 to be used do not work for me, and I have to resort to using Python 2. This is a confusing source of confusion that needs to be straightened out I feel.

I have already run the update/upgrade process to no avail. In fact, checking in the GUI package update manager (sorry I cannot recall its name presently, I’m still learning all the nomenclature) it shows minecraft as having an update available, but whenever I try to manually update those packages it fails.

Re: Minecraft Pi installed, but no mcpi folder

I wish I had read this before spending 3hrs going through the same woes

I have the exact same issue, I’ve updated my PI with the latest updates and tried to running through this: https://www.raspberrypi.org/learning/ge . worksheet/

And it fails saying there’s no module named mcpi.minecraft

I spent ages trying to sort this out and remembered and found this thread and remembered I followed a Minecraft whack a mole set of instructions and that also failed, then out of luck I tried to run the Whack a mole using Python 2 and it was fine.

So. there’s something wrong here: https://www.raspberrypi.org/learning/ge . worksheet/ if we’ve both had the same issue

Can anyone provide a fix to this as it would be great to follow the Python 3 based examples on this site

Re: Minecraft Pi installed, but no mcpi folder

Also. I’d just like to say. I think the PI is amazing

My 7yr old Son loves Scratch and I’m wanting him to get into Python now and then go further by adding extra goodies to the PI

So for all involved in PI and its support (you guys on here) you have my upmost thanks !!

Re: Minecraft Pi installed, but no mcpi folder

So after a bit more reading its clear that Minecraft PI does not work with Python 3 but some (including Ben) have looked to port Minecraft PI to Python 3 as you can see here: https://github.com/py3minepi/py3minepi

So for me one of two things should happen really to clear this up:

This https://www.raspberrypi.org/learning/ge . worksheet/ needs updating (or regressing) to show Python 2 commands not 3

This https://www.raspberrypi.org/learning/ge . worksheet/ needs updating to say you need to download this https://github.com/py3minepi/py3minepi but bear in mind its still WIP

This would save people a lot of frustration

Re: Minecraft Pi installed, but no mcpi folder

If you have the latest version of Raspbian, the Minecraft Pi API python library (mcpi) is Python 3 compatible.

Its important to keep software on the Pi up to date.

Re: Minecraft Pi installed, but no mcpi folder

Thanks LetHopeItsSnowing I can confirm I did this:

Yesterday and restarted the PI before starting on using Minecraft PI with Python 3 and had the same issues Adam had

Is there anything else I should be checking specifically?

Re: Minecraft Pi installed, but no mcpi folder

Minecraft Pi on Rasbian Jessi has no longer the «mcpi folder». Instead, the installation can be found in «/opt/minecraft-pi».

Python 3 works properly with the Minecraft installation. The problem is that most of the Python examples are old and based on
1. the «mcpi-folder» installation, which needs another import statement
2 the Python scripts are Python 2

And because I plan to use the recent installation for a Python course in school, I started a blog where I try to update all the information related to Python coding and Minecraft Pi.

The blog is not ready but I’m working on it continuously.
http://python-with-minecraft.goprogramming.space/

Re: Minecraft Pi installed, but no mcpi folder

I understand what you are saying but the instructions here: https://www.raspberrypi.org/learning/ge . worksheet/

And on your site state to use this command:

Which is where it fails for me using Python 3

Even if I type that directly into the Shell it fails saying it cannot find the module mcpi.minecraft

So if you are saying that works fine for you, I must be different? And I’m trying to understand where I should be looking for those differences

Re: Minecraft Pi installed, but no mcpi folder

Languages using left-hand whitespace for syntax are ridiculous

DMs sent on https://twitter.com/DougieLawson or LinkedIn will be answered next month.
Fake doctors — are all on my foes list.

The use of crystal balls and mind reading is prohibited.

Источник

Поделиться с друзьями
КомпСовет
Adblock
detector