how to launch pynsource?
Closed this issue · 5 comments
Once installed according to the instructions in the readme
, how do I actually launch the program?
$ ./run
yields:
Running Community Edition
LOG_FILENAME is /users/my_user/library/logs/pynsource/debug.log
This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.
If I try the executable
$ ../pynsource/bin/rungui ; exit;
/Users/my_user/pynsource/bin/rungui: line 1: cd: src: No such file or directory
python3: can't open file 'pynsource-gui.py': [Errno 2] No such file or directory
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
You cannot run within a virtual environment, unfortunately, because the GUI toolkit wxpython which pynsource relies on needs a ‘proper’ framework python environment installed to run in. A python from Pyenv may suffer the same limitation. See this discussion.
Either install requirements.txt dependencies and run using your main globally installed python (from python.org, anaconda, via brew or linux apt get), or use a standalone ready to go Pynsource binary executable from releases / downloads.
hi abulka, I did installed the requirements (with the modification described here #67) and I am not running on a virtual environment, my base python distribution is
Python 3.7.3 (default, Mar 27 2019, 16:54:48)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
... however, indeed it seems to be a bug with
# Name Version Build Channel
wxpython 4.0.7.post2 pypi_0 pypi
as the basic hello world program yields the same problem with access to the screen.
Thanks for reporting this - I should probably lock the wxpython version in requirements.txt
- but then again I'm using and shipping with that same version of wxpython e.g.
$ pip3 list | grep wx
wxasync 0.4
wxPython 4.0.7.post2
so perhaps its something else - possibly Anaconda related? I'm using brew python as my 'framework' python.
It would be nice to run a framework python via pyenv, there apparently are some clues here which I have yet to try pyenv/pyenv#99
Confirmed that you can use pyenv
Python environment for building and running Pynsource.
Here are some notes:
You can install pyenv
and use its environment for Pynsource
rather than e.g. using brew python.
Needs Python 3.7 due to my use of data classes. (Except for Linux, where I allow 3.6 to be the minimum version by conditionally avoiding data classes - due to my not knowing how to install Python 3.7 in Ubuntu 18.04 under snapcraft)
Must be a framework build but doesn't matter on windows - all pyenv installs seem to be framework builds!
Incidentally we are not using pipenv
- just using requirements.txt
Mac
Install your pyenv
Python environment with extra flags E.g. PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.7.5
As usual, when you install stuff using pip it will go into that specific pyenv environment.
wxpython seems to work ok.
Windows 10
pyenv is not fully supported under windows, but we can get by OK
Can only have one environment per Python generation e.g. 3.6.3 and 3.6.4 won't coexist but 3.6.3 and 3.7.0 will.
They all seem to be framework builds.
choco install pyenv-win
You may have to
pyenv rehash
so that the shims dir gets regenerated (on windows for sure, on mac it seems to happen automatically)
Linux
linux should use this: --enable-shared
see pyenv/pyenv#99
More Windows 10 notes re pyenv
:
For the Windows version you need to pyenv rehash
in order to get the shims dir populated and working. Do this after you install a new version of Python or install some packages via pip, and if you need the scripts
for those packages to work.
If you want a 64bit Python (recommended) the Python version you refer to needs the -amd64
suffix. E.g. pyenv install 3.8.0-amd64
- see all the Python versions available via pyenv install --list
.
Warning: Check the paths set up in windows after you install pyenv
, which unfortunately have the slashes the wrong way! And you need to move them higher in the priority or else the system python link to the ms app store kicks in instead. Just search for path
in the windows search to bring up the Windows 10 environment variables editor and move the two pyenv
entries to the top of the user PATH
.