IOError: [Errno 22] Invalid argument

888 views
Skip to first unread message

brendan spillane

unread,
Mar 11, 2015, 7:29:47 PM3/11/15
to psi...@googlegroups.com
Firstly appologies for the long post. I thought it best to start a new post will all the steps I take as someone might see where I am going wrong.  My set up: OSX Yosemite 10.10.2, psiturk 2.1.2, Python Enthought Canopy (1.4.1 64 bit)

Every time I try to run psiturk I keep getting [Errno 22]. Apparently Mac versions of Python 2.7 use the libedit version of readline but psiturk needs to use the gnu version of readline. This cannot be solved by installing the gnu version as it automatically defaults back to the libedit.

I have had this working previously with another test enviroment I set up but i just cant seem to replicate the process.

The below is my .bash_profile. As you can see it is set to use the Enthought Canopy version of Python which uses the libedit version of readline. This is recommended distribution in the psiturk docs http://psiturk.readthedocs.org/en/latest/install.html#installation-requirements

# Setting PATH for Python 2.7
#PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
#export PATH

# Setting the PATH for Python Enthought Canopy
VIRTUAL_ENV_DISABLE_PROMPT=1 source /Users/brendan/Library/Enthought/Canopy_64bit/User/bin/activate




Step 1: Python Version
Confirm which version of Python is being used on my machine. As you can see below "which python" and opening the python shell both use the Python Enthought Canopy distribution

which python
/Users/brendan/Library/Enthought/Canopy_64bit/User/bin/python

localhost:psiturktest_six brendan$ python
Enthought Canopy Python 2.7.6 | 64-bit | (default, Jun  4 2014, 16:42:26)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>




Step 2: Create an EPD like Environment using Enthought Canopy
As per the Enthought Canopy documentation http://docs.enthought.com/canopy/configure/canopy-cli.html#scenario-creating-an-epd-like-python-environment It is possible to create an EPD like environment. I first navigate to my workspace and create a new EPD

/Applications/Canopy.app/Contents/MacOS/Canopy_cli setup psiturk_test --set-default -v

This creates a psiturk_test environment which has a bin folder etc in it.



Step 3: Activate the Enviroment
I then activate this enviroment using

source bin/activate

running "which python" and opening the python shell inside this confirm that it is still using the Enthought Canopy Distribution.

which python
/Users/brendan/Dropbox/workspace/psiturk_test/bin/python

localhost:psiturk_test brendan$ python
Enthought Canopy Python 2.7.6 | 64-bit | (default, Jun  4 2014, 16:42:26)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>


Running pip freeze confirms that I am in a new environment with all the Enthought Canopy packages including readline 6.2.1



Step 4: Install psiturk
pip install psiturk

This gives me no errors



Step 5: Create the example
(psiturk_test) localhost:psiturk_test brendan$ psiturk-setup-example
Creating new folder `psiturk-example` in the current working             directory
Copying /Users/brendan/Dropbox/workspace/psiturk_test/lib/python2.7/site-packages/psiturk/example to ./psiturk-example
Creating default configuration file (config.txt)





Step 6: Confirm my credentials
Using cat ~/.psiturkconfig I can confirm that I am using the right details for both AMW and psiturk and that I am using AWS root keys




Step 7: Run psiturk
psiturk

This result in the below each time.

(psiturktestthree) localhost:psiturk-example brendan$ psiturk
libedit version of readline detected.
readline will not be well behaved, which may cause all sorts
of problems for the psiTurk shell. We highly recommend installing
the gnu version of readline by running "sudo pip install gnureadline".
Note: "pip install readline" will NOT work because of how the OSX
pythonpath is structured.

Traceback (most recent call last):
  File "/Users/brendan/Dropbox/
workspace/psiturktestthree/bin/psiturk", line 9, in <module>
    load_entry_point('PsiTurk==2.
1.1', 'console_scripts', 'psiturk')()
  File "/Users/brendan/Dropbox/
workspace/psiturktestthree/lib/python2.7/site-packages/psiturk/command_line.py", line 14, in process
    launch_shell()
  File "/Users/brendan/Dropbox/
workspace/psiturktestthree/lib/python2.7/site-packages/psiturk/command_line.py", line 104, in launch_shell
    ps.run(cabinmode=args.
cabinmode)
  File "/Users/brendan/Dropbox/
workspace/psiturktestthree/lib/python2.7/site-packages/psiturk/psiturk_shell.py", line 1787, in run
    shell.cmdloop()
  File "/Users/brendan/Dropbox/
workspace/psiturktestthree/lib/python2.7/site-packages/cmd2.py", line 1299, in cmdloop
    self._cmdloop()  
  File "/Users/brendan/Dropbox/
workspace/psiturktestthree/lib/python2.7/site-packages/cmd2.py", line 910, in _cmdloop
    self.preloop()
  File "/Users/brendan/Dropbox/
workspace/psiturktestthree/lib/python2.7/site-packages/psiturk/psiturk_shell.py", line 186, in preloop
    readline.read_history_file('.
psiturk_history')
IOError: [Errno 22] Invalid argument
(psiturktestthree) localhost:psiturk-example brendan$


I am fairly sure it must still be creating the Enviroment using the native version of Python on my machine or somhow it is referenceing it. But as you can clearly see I have created the enviroment using Enthought Canopy using (what I believe) is the correct method

If anyone can spot what I am doing wrong it would be very much appriciated

Thanks

Brendan





Todd Gureckis

unread,
Mar 11, 2015, 7:43:30 PM3/11/15
to brendan spillane, psi...@googlegroups.com
Every time I try to run psiturk I keep getting [Errno 22]. Apparently Mac versions of Python 2.7 use the libedit version of readline but psiturk needs to use the gnu version of readline. This cannot be solved by installing the gnu version as it automatically defaults back to the libedit. 

yeah that might be true about the system python but not if you install something like EPD.


On Mar 11, 2015, at 4:29 PM, brendan spillane <brendantho...@gmail.com> wrote:

libedit version of readline detected.
readline will not be well behaved, which may cause all sorts
of problems for the psiTurk shell. We highly recommend installing
the gnu version of readline by running "sudo pip install gnureadline".
Note: "pip install readline" will NOT work because of how the OSX
pythonpath is structured.

as the error message you get says, why don’t you trying installing gnureadline inside your
EPD-like environment?  that was not one of the steps you showed doing.

brendan spillane

unread,
Mar 11, 2015, 7:52:25 PM3/11/15
to Todd Gureckis, psi...@googlegroups.com
I just tried "sudo pip install gnureadline"

But I get back

Requirement already satisfied (use --upgrade to upgrade): gnureadline in ./lib/python2.7/site-packages
Cleaning up...
(psiturktest_eight) localhost:psiturktest_eight brendan$ pip install gnureadline

And still no joy when I run psiturk


Todd Gureckis

unread,
Mar 12, 2015, 3:10:17 AM3/12/15
to brendan spillane, psi...@googlegroups.com
did you see this recent post on the github issues:
?

btw, i suspect readline/gnureadline once again changed its behavior on us and so we need to make a change
to the code….

brendan spillane

unread,
Mar 12, 2015, 5:16:04 PM3/12/15
to psi...@googlegroups.com, brendantho...@gmail.com
No I had not and thanks for pointing that out, it worked perfectly.

I thought I was going mad there for a while.

Best

Brendan
Reply all
Reply to author
Forward
0 new messages