Unable to install PsychoPy module in Python - python

I tried to install the psychopy module in python, using Anaconda Prompt and python -m pip install PsychoPy and it gave me error messages I have no idea how to interpret:
enter image description here
followed by a bunch of white text mostly starting with "Requirement already satisfied: [...]" and two other red walls of text "ERROR: Command errored out with exit status 1: [...]" (I can also post pictures of them, if needed)
Additional Info:
I use a Windows 10, Version 21H2, x64-based System
For Python (3.8.8) I use Sypder
Anaconda Navigator is Version 2.0.3
I also have the PsychoPy Standalone (Coder, Runner & Builder) installed (version 2022.2.0)
Any and all help is appreciated!!
Please also tell me if I did this question-thing right, this is my first time posting here and I don't know the etiquette yet

This is not for sure.
Maybe you already solve this problem.
I have experienced some problem of psychopy.
So, I hope this is helpful for you and many other researchers with psychopy.
First, update conda will solve many kind of problems.
'''
conda update --all
'''
Second, In anaconda environment using 'conda' command is recommendation.
In anaconda environment use(except for impossible) 'conda' command is recommended. Generally, mixed use of 'pip' and 'conda' command is not matter. BUT, SOMETIMES, this could occur minor error like this question.
Third, use anaconda virtual environment.
Anaconda provide virtual environment. Initially virtual environment looks confused but, this could safe and secured develop your experiment program.
Lastly, this probelem.
In the middle of your error message. "requires-python>=3.6" <- maybe this means your environment is not appropriate the environment. but your environment is 3.8.8.
For now this is just hypothesis. I think your environment have more than 2 of python could be installed. So, delete all python and reinstall the anaconda and use virtual environment could be safe.
I haven't used this community for a long time so I don't know the etiquette. If I was rude, thank you for your understanding.

Related

Trying to check my Python packages but keeps telling me that aiohttp is not installed

I am trying to check what packages are installed in my virtual environments, I have different packages from different virtual environments depends on what project I am working on. Whatever virtual environment I switch I always get this error when using help("modules")
aiohttp dependency is not installed: No module named 'aiohttp'. Please re-install black with the '[d]' extra install to obtain aiohttp_cors: `pip install black[d]`
My question is how do I install this package correctly, and by that I mean should I install it in my main Python PATH? I'm not sure if this is a mandatory package that I need it installed in my main environment if that makes sense.
My Python version is 3.9.6 by the way.
EDIT: I was able to fetch all of my packages.
I had to do a . Scripts/activate first, but it was weird because before I did not have to do the activate command before, since VS Code displays on the lower left portion of the screen what environment you are currently using, I'm not sure if I had any settings change prior to this bug.
Maybe you should try to open new terminal

IDLE and python is different, not able to install modules properly

thanks for reading this. I am using macOS High Sierra. I am not very familiar with terminal or environment variables, but am trying to learn more. From reading other threads and google, it seems like I either have multiple pythons installed, or have pythons running from different paths. However I am not able to find a solution to resolving this, either by re-pathing my IDLE or deleting it entirely.
I do have python, python launcher, and anaconda (not very sure how anaconda works, have it installed a few years back and didn't touch it) installed. I am trying to install pandas (pip install pandas), which tells me that I have it installed, but when I run it on IDLE, it says module not found. Though if i run python3 on terminal and type my code in, it works (so pandas has indeed been installed).
When i run which python on terminal, it returns
/Users/myname/anaconda3/bin/python
(when i enter into this directory from terminal, it shows that in the bin folder, I have python, python.app, python3, python3-config, python3.7, python3.7-config, python3.7m, python3.7m-config)
When i run which idle on terminal, it returns
/usr/bin/idle (im not even sure how to find this directory from the terminal)
When i run import os; print(os.path) on IDLE, it returns module 'posixpath' from '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/posixpath.py'
Would really appreciate some help to figure out how to ensure that when i install modules from terminal, it would be installed into the same python as the one IDLE is using. Also, I would like to know whether it is possible for me to work on VSCode instead of IDLE. I cant seem to find suitable extensions for data science and its related modules (like statsmodels, pandas etc). Thanks a lot!
First of all, a quick description of anaconda:
Anaconda is meant to help you manage multiple python "environments", each one potentially having its own python version and installed packages (with their own respective versions). This is really useful in cases where you would like multiple python versions for different tasks or when there is some conflict in versions of packages, required by other ones. By default, anaconda creates a "base" environment with a specific python version, IDLE and pip. Also, anaconda provides an improved way (with respect to pip) of installing and managing packages via the command conda install <package-name>.
For the rest, I will be using the word "vanilla" to refer to the python/installation that you manually set up, independent of anaconda.
Explanation of the problem:
Now, the problem arises since you also installed python independently. The details of the problem depend on how exactly you set up both python and anaconda, so I cannot tell you exactly what went wrong. Also, I am not an OSX user, so I have no idea how python is installed and what it downloads/sets alongside.
By your description however, it seems that the "vanilla" python installation did not overwrite neither your anaconda python nor anaconda's pip, but it did install IDLE and set it up to use this new python.
So right now, when you are downloading something via pip, only the python from anaconda is able to see that and not IDLE's python.
Possible solutions:
1. Quick fix:
Just run IDLE via /Users/myname/anaconda3/bin/idle3 every time. This one uses anaconda's python and should be able to see all packages installed via conda install of pip install (*). I get this is tiresome, but you don't have to delete anything. You can also set an "alias" in your ~/.bashrc file to make the command idle specifically linking you there. Let me know with a comment if you would like me to explain how to do that, as this answer will get too long and redundant.
2. Remove conda altogether (not recommended)
You can search google on how to uninstall anaconda along with everything that it has installed. What I do not know at this point is whether your "vanilla" python will become the default, whether you will need to also manually install pip again and whether there is the need to reinstall python in order for everything to work properly.
3. Remove your python "vanilla" installation and only use anaconda
Again, I do not know how python installation works in OSX, but it should be reasonably straightforward to uninstall it. The problem now is that probably you will not have a launcher for IDLE (since I am guessing anaconda doesn't provide one on OSX) but you will be able to use it via the terminal as described in 1..
4. Last resort:
If everything fails, simply uninstall both your vanilla python (which I presume will also uninstall IDLE) and anaconda which will uninstall its own python, pip and idle versions. The relevant documentation should not be difficult to follow. Then, reinstall whichever you want anew.
Finally:
When you solve your problems, any IDE you choose, being VScode (I haven't use that either), pycharm or something else, will probably be able to integrate with your installed python. There is no need to install a new python "bundle" with every IDE.
(*): Since you said that after typing pip install pandas your anaconda's python can import pandas while IDLE cannot, I am implying in my answer that pip is also the one that comes with anaconda. You can make sure this is the case by typing which pip which should point to an anaconda directory, probably /Users/myname/anaconda3/bin/pip
First: This would be a comment if I had enough reputation.
Second: I would just delete python. Everything. And reinstall it.
To repeat and summarized what has been said on various other question answers:
1a. 3rd party packages are installed for a particular python(3).exe binary.
1b. To install multiple packages to multiple binaries, see the option from python -m pip -h.
To find out which python binary is running, execute import sys; print(sys.executable).
3a. For 3rd party package xyz usually installed in some_python/Lib/site-packages, IDLE itself has nothing to do with whether import xyz works. It only matters whether xyz is installed for 'somepython' (see 1a).
3b. To run IDLE with 'somepython', run somepython -m idlelib in a terminal or console.
somepython can be a name recognized by the OS or a path to a python executable.

'python' points to anaconda installation

I've installed anaconda, but I still want to use python as normal within a Terminal window (zsh). At the moment, running which python shows /Users/USERNAME/opt/anaconda3/bin/python.
I don't want this command to point to my anaconda installation. I want to use python as I have in the past, and for it to point to my python 2.7 installation (/usr/bin/python).
The same issue is present with pip and with python3. How do I change these paths back to their default locations?
I want to start out by saying I personally have never used Anaconda, but I have many friends who have and they always seem to wind up getting into hot water as far as configurations go. If you don't need the data-science specific tools that Anaconda offers (most of which I imagine you can get just as easily by using pip install <package_name>), then I STRONGLY urge you to not use Anaconda. I would suggest you instead use homebrew to install python 3.7 and leave the system version of python 2.7 alone... Anyways...
I recently fixed an issue similar to the one you're describing for a friend. I ended up deleted his anacaonda build and reinstalling fresh from homebrew (link: https://brew.sh/), so this is how I helped him and hopefully this will help you too.
Firstly, I would check the configuration of your ~/.bash_profile (or potentially ~/.bashrc) file. Comment out any lines you find that have to do with Anaconda by preceding with the # character. I believe when anaconda installs it puts the location of the anaconda-version-of-python higher in the PATH hierarchy, therefore you computer sees it first before it has the chance to look in /usr/bin...
Secondly, you need to move the anaconda-python to the trash... I would start by trashing the whole '/Users/USERNAME/opt/anaconda3' directory. If memory serves me correctly anaconda stores other python related things in the /MacitoshHD/Library/Frameworks directory, but don't quote me on that. I would advise looking there and trashing whatever seems to be related to the anaconda install.
After that, in a new terminal (so that your PATH refreshes), I installed homebrew, and then ran the command brew install python3 to install python3. I think perhaps I ran the command recommended in the installer output, something like "brew link python3" to symlink python3 where it needs to be linked after the installation.
Finally, everything is done python2 and python3 are installed and working with no issues. python2 is the system default version and python3 is the homebrew installed version. Feel free to ask any questions and I will try to help more, hopefully those instructions will get you started though.

Running pip3 on MacOS Sierra (Python newbie) - do I need a virtualenv?

I'm running MacOS Sierra 10.12.6
By default the system came with Python 2.7.10
I installed Python 3.6.3 (with IDLE) so I can learn Python (3). I understand that this is normal as MacOS may rely on Python 2.x for some programs. Either way, Python3 runs just fine if I run python3 from the command line/terminal, or if I use IDLE (which defaults to Python 3).
Now I want to install some libraries like Beautiful Soup.
And I believe I can install it as follows:
pip3 install beautifulsoup4
which should automatically install it. However, I read that it's recommended to use virtualenv on Mac BEFORE I run the above command. As a newbie, I don't want to mess anything up on my PC, so can anyone point me out how I can do this correctly?
For example, I can follow this link: http://sourabhbajaj.com/mac-setup/Python/virtualenv.html
But I just want to write here to make sure I'm following the right article/commands before I do it. Just being super careful!
Also, can I make a folder with my "virtual environment" and then add sub-folders inside that for each project? Meaning, I don't need to do this everytime, I have one virtual environment and any project that I do just is a subfolder within that space so I can use any libraries that I installed. Just trying to grasp the concept.
Thanks!
Sorry to add confusion.. this can be a tough subject for someone starting out.
The official docs recommend venv, which is similar to, but slightly different than virtualenv.
I would strongly recommend pycharm. It will create your venv for you as part of your project, which you might find helpful.
[Edit: Some other virtual environment features of pycharm that will help you].
If you type in an import statement for a package that isn't installed, it will offer to install it for you.
typing alt-F12 will bring you up a console with your virtual environment active
It syncs up your requirements.txt document for you
It manages your virtual environment path for you (as long as you are running inside pycharm), helping avoid import problems that many newcomers have with virtual environments.
I am not affiliated with pycharm, btw -- I just think it is a great tool for python developers, especially for newcomers, and its treatment of virtual environments is especially helpful.
You create one virtualenv for each project as a way of keeping track of the specific dependencies to keep them minimal which then makes it easier when you want to share projects with other people.
But this is not something you need. No harm comes from installing packages in your real environment as well. So you can safely run
pip3 install beautifulsoup4

Anaconda update for Spyder has failed

Windows 10, 64 bit Anaconda 4.2, Python 3.5
I opened Spyder today to do some work. (so much for that idea, several hours later)
Spyder gave notice that there was new (3.1) version. I was on 3.0.2
So, I tried updating
conda update spyder
but it told me that it needed to DOWNGRADE it because of dependencies (I think, I wasn't taking notes at the time - so much for optimism)
Then I tried to update conda but that made things worse at this point, Spyder wouldn't start at all.
So, I uninstalled everything. At least, I think I did.
I went through Windows Programs and looked for anything that looked like it might be part of Anaconda, python, or Spyder.
I tried reinstalling Anaconda.
I got the 3 error messages about menus, path, and directories (there's a bunch of tickets on those). My path is short (800 characters or so) and my user name is in English.
I uninstalled and tried again.
Same results.
I created and ran the Fix.bat
"C:\My_Stuff\Program_Files\Anaconda3\pythonw.exe" -E -s "C:\My_Stuff\Program_Files\Anaconda3\Lib\_nsis.py" addpath
"C:\My_Stuff\Program_Files\Anaconda3\pythonw.exe" -E -s "C:\My_Stuff\Program_Files\Anaconda3\Lib\_nsis.py" mkdirs
"C:\My_Stuff\Program_Files\Anaconda3\pythonw.exe" -E -s "C:\My_Stuff\Program_Files\Anaconda3\Lib\_nsis.py" mkmenus
and that at least gave me my menus.
From a command prompt (either Anaconda or Windows),
conda list
shows no packages.
Spyder and Anaconda Navigator do not start ("This application failed to start because it could not find or load the Qt platform plugin "windows"
in "".)
Typing python from a command prompt (either one) appears to work and references Anaconda 4.2.0
I'm going around in circles.
Any help appreciated.
Craig
I had posted this on Github too, as I ran into a larger problem while trying to get my system back.
The last comment from that thread (https://github.com/conda/conda/issues/4369) is repeated here:
I have, I believe, successfully installed Anaconda 4.2 64bit Python 3.5 version
I uninstalled the software again using the Windows 10 uninstall from Programs and Features.
I manually removed the Anaconda paths from the user PATH variable.
I manually removed the Anaconda folder from the Startup menu.
I manually removed selected references to Anaconda in the registry.
(I did not see the Anaconda clean program until later - https://docs.continuum.io/anaconda/install)
I rebooted.
I installed from the exe I had downloaded last year (4.2)
This time, I installed for all users, not just me.
Testing
`conda list
returns many packages. Yeah!
Calling python from a command prompt works too.
Spyder starts and remember my previous project, so that is nice too.
I think I can work again.
I may need to upgrade some packages, so hopefully that will go well too.
Craig

Categories