psychopy.org | Reference | Downloads | Github

Problem while installing psychopy module in anaconda spyder

spyder
#1

Dear all,
I am trying to install psychopy module in Python anaconda spyder 32 bit. I have tried with pip install psychopy. Since it is company’s laptop it did not worked out well. Then I have tried to do it with proxy like ‘pip --proxy (IP add) install psychopy’. It got installed. When I tried to import various objects like core, data etc. It is showing me an import error like:

from psychopy import core, data, event, gui, visual
ImportError: cannot import name core 

Here is the code.

import serial
from time import sleep
import struct
from psychopy import core, data, event, gui, visual 

try:
    arduino = serial.Serial('COM8',19200)
    sleep(2)
    print("Connection to " + 'COM8' + " established succesfully!\n")
except Exception as e:
    print(e)

global command 
global win

win = visual.Window(size=(1680, 1050), fullscr=True, screen=0, allowGUI=True, allowStencil=False,
monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
blendMode='avg', useFBO=True,
) #TODO: handle in a different way the screen resolution

instruction1 = visual.TextStim(win, text=u"""Press i to start!""")

instruction2 = visual.TextStim(win, text=u"""Press e to stop!""")

instruction3 = visual.TextStim(win, text=u"""Thank you!""")

instruction1.draw()  
sleep (2)  
win.flip()
if 'i' in event.waitKeys():
    sleep (2)
    command = arduino.write(struct.pack('>B', 1))
    instruction2.draw() 
    
    win.flip()
    if 'e' in event.waitKeys():
        sleep (2)
        command = arduino.write(struct.pack('>B', 0))
        instruction3.draw()    
        win.flip()
        win.close ()

arduino.close()

If I remove core from import, the next error will be data then event then GUI etc.
Can anyone help me to resolve this issue?
Greetings,
Ravi

1 Like

#2

Hi @Ravi_Mevada, did you try to install PsychoPy for Anaconda using these guidelines?

0 Likes

#3

Hi @dvbridges, I have tried to follow those steps. First three works fine, but with the forth one, there is a problem. It is showing me packages not found error: The following packages are not available from the current channel then there is a list of current channels. I have tried to use those but still the same error. Then I have tried to install them one by one with pip and then it works. The forth step also works fine. Then I have tried to run the main script. Now I am getting error saying ‘no module named psychopy’. Then I have tried pip install psychopy but in return I am getting same error.

0 Likes

#4

Solution: By installing the other two items below, the only 2 errors I see left is that it cannot install ‘greenlet.’ I checked, and anaconda said it was installed. There is also a PackagesNotFoundError for pysoundfile

(FYI I followed the guidelines on the Psychopy website for PC that @dvbridges linked. There are installation errors unless these two additional items are installed).

Problem:

*Psychopy is still shy around Spyder, so Spyder STILL cannot import psychopy corrrectly. Missing module.

*And cannot install pysoundfile

Attempt at pysoundfile solution: looked up on Anaconda: https://anaconda.org/conda-forge/pysoundfile/files

But I get the same packagesNotFoundError and I am unsure where to download these files to.

conda create -n psypy3 python=3.5

conda activate psypy3

conda install numpy scipy matplotlib pandas pyopengl pillow lxml openpyxl xlrd configobj pyyaml gevent greenlet msgpack-python psutil pytables requests[security] cffi seaborn wxpython cython pyzmq pyserial

conda install -c conda-forge PyPubSub

conda install -c conda-forge pyglet python-bidi moviepy pyosf

conda install -c conda-forge pywinhook

pip install zmq json-tricks pyparallel sounddevice pygame pysoundcard psychopy_ext psychopy

0 Likes

#5

When I follow your steps above I get the next error message.

Cannot uninstall 'greenlet'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Any idea how to fix this?

0 Likes

#6

@Alexander_Kern I have not tried to uninstall any of the packages.
I just know that with the steps above, I still have the two errors that are mentioned in Solution:

Hopefully, we’ll get some answers.

0 Likes

#7

I have the same issue - have you found any solution yet?

0 Likes