Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to Python 3.x and 64 bit? #131

Open
arnohakk opened this issue Jun 6, 2019 · 10 comments
Open

Move to Python 3.x and 64 bit? #131

arnohakk opened this issue Jun 6, 2019 · 10 comments

Comments

@arnohakk
Copy link

arnohakk commented Jun 6, 2019

Hey,

when just reinstalling our system, Python 2.7 told me that it is getting towards the end of its life cycle.

As a Tobii User, I found that the new SDK supports Python 3.X and 64bit systems, same holds true for PsychoPy. I don't know about the other manufactures SDKs though.

@esdalmaijer Do you think about migrating to Python 3.X 64 bit? I think we (with the help of Tobii, who are usually interested in giving researchers this kind of support) could help from the Tobii SKD side and also do some testing.

Cheers,

Arne

@esdalmaijer
Copy link
Owner

Hi Arne,

There isn't a day that I don't think asbout it. (Usually after waking up from a stress dream that includes the Python clock.)

In fact, @jooh made a first stab at it a while back (see this pull request. From local testing by colleagues, this seems to work, at least with EyeLink.

I haven't found the time to properly focus on this, but applaud and am happy to support any thorough attempt. In general, there shouldn't be a lot that isn't currently compatible with Python 3, I think. However, going over the whole codebase to double-check, and even checking the whole codebase after an automated pass-through, will probably be quite a bit of work,

Cheers,
Edwin

@dev-jam
Copy link

dev-jam commented Jul 1, 2019

Hi Edwin,

Maybe if you split up the codebase, a couple of people can do a part of the manual checking?
I volunteer to do a part.
Is the opensesame plugin part already py3 compatible?

Cheers,
Bob

@lorenzleutgeb
Copy link

The time is now... https://www.python.org/doc/sunset-python-2/

@arnohakk
Copy link
Author

Hey, I just saw that there was an update to Python3 :) What do I have to consider when moving to this new version, e.g. dependencies?

@esdalmaijer
Copy link
Owner

Yassss, we finally did it! Sorry it took a while, this ended up being more effort than I had hoped, especially when having to test on various platforms. Specific dependencies below.

TL;DR: Your Python 2 code should work on Python 3 as far as PyGaze functions go. Obviously you'll have to make sure that Python-specific things are converted (e.g. raw_input to input), but PyGaze shouldn't give you any grief.

  • Python 3, obviously.
  • PyGame: Totally fine to simply hop onto the PyGame version for Python 3 without issue. I love this package so much.
  • PsychoPy: Fine in general, but I haven't been able to install one of its dependencies (pywinhook) on Windows. Not sure why, but it simply fails to install through pip and conda. It doesn't seem to affect anything in PyGaze, though. (As in: I've not yet found anything that depended on it.)
  • PsychoPy dependencies: After installing Anaconda3 and then PsychoPy, it didn't run out of the box for me. I had to update pillow, numpy, scipy, and matplotlib. Not sure why, not sure how general this problem is; my issues appeared on Win7 and later on Win10 in a conda environment (but some of that was to do with conda specifically; I ended up using only pip to reinstall everything, and that worked out nicely).
  • lxml: You'll need this for OpenGaze (==GazePoint). The Python 3 version works without issue.
  • pylink: You'll need this for EyeLink. You'll have to ask for the Python 3 pylink version from SR Research directly (they didn't have one publicly available when we were starting to move over near the end of last year; they might do now?). This will be version 1.11, which might or might not be newer than you're used to. This caused some issue in PyGaze's streaming of the eye image in the calibration setup to the stimulus PC, which has been resolved in the update to Python 3. (We now test if you're using pylink 1.11 or higher, and change our drawing routine based on that. If you see a crosshair that doesn't accurately pinpoint pupil and glint, please tell me.)
  • PyOpenGaze, PyTribe, and PyAlea: These are Python libraries I develop and maintain for GazePoint, EyeTribe, and Alea eye trackers. All of these are already included within PyGaze, and thus ready to be used in Python 3.
  • Tobii: tobii_research is available from Tobii, also for Python 3. I don't think there's any difference from a user's perspective for Python 3, but I haven't been able to properly test this.
  • SMI: I've updated the SMI code in PyGaze, so things should work in Python 3 (the ctypes interaction required a wee bit of work). This simply wraps a DLL that shouldn't be affected by Py2 vs. 3).

PS: Don't update a working experiment! If you're still collecting data, wait with changing stuff until you're finished! Also, Python 3 can exist alongside Python 2, either as local installs or as conda environments. So I would strongly recommend trying to get your Python 3 environment up and running alongside your currently running Python 2 environment.

@esdalmaijer
Copy link
Owner

esdalmaijer commented Jan 22, 2020

Oh, I forgot to mention! There is still a Python 2.7 snapshot that people can still contribute to if they find any bugs. It's in a branch called python27: https://github.com/esdalmaijer/PyGaze/tree/python27

If you're wanting to install this older snapshot in a Python 2 environment, simply run:
pip install python-pygaze=0.6.5

@harsh183
Copy link

I'm planning on getting started with this sometime this week and while I do have conda setup I'd strongly prefer to use everything with with Python3 (as python 2 is now EOL). After skimming above seems to be at a reasonable stage.

  1. How would I go by trying to install this for Tobii 4c, Ubuntu 18.04, Python3? What should my 'requirements.txt' look like?

@esdalmaijer
Copy link
Owner

The same as for Python 2, essentially :)

Generally:
pip install numpy scipy matplotlib pillow

Add PyGame:
pip install pygame

Add PsychoPy and its dependencies:
pip install psychopy

If you're wanting to use a GazePoint tracker:
pip install lxml

And for Tobii:
pip install tobii_research

For EyeLink, there is a Python3 version of pylink available, but you'll have to request it from SR Research. (Their support forum is a great venue to do so, and I think they might even have it available directly through there. You'll have to make an account, but it's free.)

The one point you should consider with Tobii, is that tobii_research currently only supports Python 3.5. See: https://pypi.org/project/tobii-research/

@harsh183
Copy link

harsh183 commented Feb 21, 2020

Should I setup some conda or virtual env for this then? I'm using the Tobii 4c and Ubuntu 18.04.

Can you put this on the main website or documentation somewhere since I felt all the instructions are made with Python2 in mind?

I will setup the following after making sure I am on python==3.5

  1. pip install numpy scipy matplotlib pillow
  2. pip install pygame
  3. pip install psychopy
  4. pip install tobii_research

Will there be any other pieces of setup I have to do?

@Sme1d
Copy link

Sme1d commented May 14, 2020

The one point you should consider with Tobii, is that tobii_research currently only supports Python 3.5. See: https://pypi.org/project/tobii-research/

In fact Tobii-research also supports 3.6.0. as I just was informed by the Tobii support. The information on PyPi is probably not updated. I tried it out under 3.6.0 and it works. Maybe this helps people with the same issue as me wondering how PsychoPy and Tobii-research can work together if the support different Python versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants