esdalmaijer / PyGaze

an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments
www.pygaze.org
GNU General Public License v3.0
670 stars 211 forks source link

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

Open arnohakk opened 5 years ago

arnohakk commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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

arnohakk commented 4 years ago

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 commented 4 years ago

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.

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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.