I am a beginner in python. I use windows 10 and IDLE. I have cloned a code from github and there are a bunch of *.py files. when I run the main code in python IDLE there is an error:
ModuleNotFoundError: No module named 'mayavi'
I tried to install mayavi in windows cmd using "pip", but again there is a long error starting with this sentence:
ERROR: Command errored out with exit status 1:
it seems that it is a bit complicated to install mayavi.
is this package installation thing a problem in IDLE? what if I use another IDE?
In fact I am not sure that IDLE is a good choice for coding python or not? In addition I am using python 3.10.1.
I look forward to hearing your advices.
Thanks in advance
Try AnaConda. It will manage the installation of python packages in an organized way.
The main probem was VTK installation. I tried the procedure explained here:
https://www.youtube.com/watch?v=IgvbhyDh8r0&t=222s
Related
This question is not a duplicate of this question, because I am trying to create an app.
I am currently following this tutorial, but when I try to run my app,
my command prompt prints out this error:
Why does this error happen and how can I solve it? I read through all the answers to the linked question, but none of them are pertinent to my problem.
Please anyone help me, I still haven't found a working solution; I am getting desperate!!!
Edit: I can't just install and uninstall pynput? Idk why it doesn't work because shouldn't pynput come with idle?
Version: 3.74 python idle, most updated version of pyinstaller
The following might help you if you haven't tried them already:
Update pip from the command line
Unistall pyinstaller
Re-install pyinstaller and try it again
If the above does not work, try running the following command in the command line. Make sure there are some print statements in your code to see if it works.
python monitoring_culmination_product.py
If you got a message saying "python is not recognised as an internal or external command" then python might have not been added as an environment path.Try this to fix the issue.
You could always re-install python if things get difficult.(make sure you install the appropriate version 32-64bit)
If the command though executed without a problem. Try to use pyinstaller on another file to see if the problem has to make sure the problem has to do with pyinstaller.
From a personal experience, pyinstaller can be unreliable at times so I put the following line in my projects just to make sure. It might help you too.
import pkg_resources.py2_warn
Disclaimer: Although it is not specified I assume that you are using Windows
You could try to use conda create to get an environment containing all the need dependencies (numpy, etc) and then use pyinstaller as explained in this discussion.
Please fall back to 1.6.8 version of pynput. pip install pynput==1.6.8
Ref : https://stackoverflow.com/a/63721929/14759065
I'm having a problem with importing modules in python.
When I run my program in the command line it works perfectly fine.
However, when I try to run the same program in the python shell I am prompted with the following error:
ModuleNotFoundError: No module named 'matplotlib'
I already successfully installed matplotlib using 'python -m pip install matplotlib'.
I've read this can happen when you have two different versions of python installed; however, I don't.
I've uninstalled and reinstalled python and I still am having the same issue. I've also uninstalled and reinstalled matplotlib using pip.
I believe my problem is the module paths that python uses to search for imported modules are different between the two.
When I use the 'print(sys.path)' command in the python shell and the command line I get two different outputs.
Any help would be greatly appreciated!!!
The file different system paths between the python shell and the command line
You have two versions of python. I would recommend you to remove all pythons you have and go for anaconda https://www.anaconda.com/distribution/. It will fix your path problems and allow you to create environments with different versions of python. This is the least painful way also for future :) good luck.
I suppose, you have both of the Python versions installed on the same computer.
If that is so, then my answer would be to go inside both Python script folders and install matplotlib on both of them.
I have also faced that issue. My path includes pip of Python 3.7.1 and whenevwer I try to import modules on Python 3.4. It throws an error!
Maybe, you could add both of the Pythons to the path.
I encountered this same problem – python -c "import sklearn" would work just fine, but import sklearn inside a Python program failed. Both my one-liner and program was using the same Python version (version 3.8.10).
I eventually got the program to work by replacing the shebang line (originally #!/usr/bin/python) with #!/bin/env python.
I don't know why this worked exactly (sorry). Presumably some path got reset, and the module loaded from a different location, but it might help someone so I'm posting it here nontheless. (If you know more, feel free to edit this answer.)
I'm getting:
"ImportError: No module named builtins"
that has only started happening after I installed a later version of PsychoPy (an application that uses Python that is used for writing psychology experiments). I was not getting this problem with an older version
I tried doing "sudo pip install future" like someone else recommended for fixing a similar problem. However, when I do this I get an "invalid syntax" error, and don't know of any other way around the problem. I would greatly appreciate any help on this.
Edit
Could it be you enter the command into a Python prompt? You are supposed to enter that command on the command line of your operating system shell. Which means not inside Python.
Original Answer
Like Deesha already mentioned in their comment, you must install the future package into the Python environment you wish to run PsychoPy in, e.g. via pip:
pip install future
or via conda:
conda install future
This is because newer versions of PsychoPy support both Python 2.7 and 3. The future package is used to ensure the code runs on both platforms.
I know this question has been posted a couple time before, but I have tried everything those threads have suggested (using a terminal, making sure pip is updated, making sure it is in the right folder, etc.) and I am still unable install new packages. Would anyone have any new suggestions, I'm at a loss at what to do at this point. Thank you very much.
The error that I am encountering in both the terminal and in Pycharm
You cannot install os from PyPI — os is a module from the standard library.
I have been trying for quite some time now to make my Python program run on pc's that don't have python installed. I have issues because I'm using python 3.6.0. In this post I am going to discuss a method I got from this video.
The first thing I did, was install Python 3.5 and create a virtualenv for it, which I activated. You can see how I did that on the post I made earlier today. After I activated the environment, I used this command in cmd in the python 3.5 environment: pip install cx_Freeze. It got installed with no errors. Then I made this setup.py file:
from cx_Freeze import setup, Executable
setup(name='vkv',
version='0.1',
description='Berekent de wortels van een vkv',
executables = [Executable('vkv.py')])
The python file that I want to turn into a .exe file is called vkv.py. The vkv.py file and the setup.py file are both the only 2 files on this path: C:\Users\hp\Desktop\Code\Python testing\distr.
Ok so now I only have to enter setup.py build in the command line in order to make the .exe file. But when I do that, I get a bunch of lines, with an error on the last line:
AttributeError: module 'dis' has no attribute '_unpack_opargs'
Here is a screenshot of it:
Does anyone know what I did wrong? Is it something in the setup.py file, is it not setting up the virtualenv correctly? And does anyone know what this error means and how I can fix it?
You are dealing with an version of cx_freeze that has a bug that manifests itself for versions larger than 3.5.2, this issue has already been reported here and fixed.
In short, a small change was introduced in Python 3.5.2 that cx_freeze failed to catch, now a check is made to work smoothly.
In short, you'll need to update cx_freeze, you could either try pip install -U cx_freeze or get the source for it.
p.s Using Python 3.6 right now probably isn't the best idea since quite some changes were made and bugs might take a while to be caught and fixed.