Closed murphyk closed 5 months ago
I did not include a setup file because it's such a simple program.
It requires no python packages besides the python3.
It requires several LaTex packages (see the global HEADER0 for a bare minimum of LaTex packages required)
All the python code is contained in 2 files, texnn.py
and globals.py
.
If it can't find the texnn.py file it means you have to cd to the directory in which the texnn.py file is located. I use PyCharm for python and TexStudio for LaTex and this is all done automatically.
On Sun, Apr 14, 2024 at 9:21 PM Kevin P Murphy @.***> wrote:
Hi. I am not able to use your code in its current form (perhaps due to my ignorance). I did git clone https://github.com/rrtucci/texnn.git and then pip3 install -e . but this gives the error
ERROR: File "setup.py" or "setup.cfg" not found. Directory cannot be installed in editable mode: /Users/kpmurphy/github/texnn
I then tried running python3 asia/asia.py from the texnn directory but get the error
from texnn import * ModuleNotFoundError: No module named 'texnn'
— Reply to this email directly, view it on GitHub https://github.com/rrtucci/texnn/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZWTYIWADAPPMEH3UYWVQTY5MTQDAVCNFSM6AAAAABGGNPIWWVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DENBZGI3DCOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
If I copy 'asia.py' to the top level directory where texnn.py
and globals.py
live, it all works fine.
But I wanted to avoid polluting the top level with example diagrams.
I suppose PyCharm is adding some directory names to your path ?
I think so. My impression is that PyCharm does a cd to the top directory every time you run any python file. I always assume it is going to start looking at the top directory.
On Mon, Apr 15, 2024 at 1:01 PM Kevin P Murphy @.***> wrote:
If I copy 'asia.py' to the top level directory where texnn.py and globals.py live, it all works fine. But I wanted to avoid polluting the top level with example diagrams. I suppose PyCharm is adding some directory names to your path ?
— Reply to this email directly, view it on GitHub https://github.com/rrtucci/texnn/issues/1#issuecomment-2057403005, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADZWTYLB5JL2TC3E7MW5TT3Y5QBXXAVCNFSM6AAAAABGGNPIWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJXGQYDGMBQGU . You are receiving this because you commented.Message ID: @.***>
My colleague suggested this way to make things easier for others to use.
__init__.py
to texnn
directory.setup.py
file (see below) to texnn
directory python setup.py develop
python asia/asia.py
from texnn
directory and it works.Contents of setup.py
:
NAME = 'texnn'
VERSION = '0.0.1'
if __name__ == '__main__':
setuptools.setup(
name=NAME,
version=VERSION,
packages=setuptools.find_namespace_packages('texnn'),
)
However, your example scripts also write to the top level directory. So I made this tweak to asia.py
so it writes to the directory that contains the example script.
import pathlib
dir = str(pathlib.Path(__file__).parent.resolve())
name = dir + "/asia"
# ... continues as before
Hi. I am not able to use your code in its current form (perhaps due to my ignorance). I did
git clone https://github.com/rrtucci/texnn.git
and thenpip3 install -e .
but this gives the errorI then tried running
python3 asia/asia.py
from the texnn directory but get the error