From nad at python.org Thu Mar 3 16:15:11 2022 From: nad at python.org (Ned Deily) Date: Thu, 3 Mar 2022 16:15:11 -0500 Subject: [Pythonmac-SIG] Hi. I am having difficulty installing NLTK on my Mac (12.02.01). Is there anyone who can help? In-Reply-To: <34553549-1C22-4E24-AE20-8FD6B077B249@me.com> References: <34553549-1C22-4E24-AE20-8FD6B077B249@me.com> Message-ID: <9AF632E7-D19D-4331-A809-5A71BF9788A8@python.org> On Feb 27, 2022, at 15:51, Robert Wasserman via Pythonmac-SIG wrote: > > I?ve been learning pylon on my Mac and and am trying to install NLTK so I can try the examples in the NLTK text. > > The instructions in NLTK are straightforward and I am able to get Python itself on my computer, but I cannot get ?pip? to work. > > I would appreciate any help or sources of help. My problem seems to be getting Python to work on the data provided in the NLTK. Sorry but without more information, it is impossible to provide meaningful help. But the most common problem with using pip is trying to use the wrong version of pip. The best way to avoid that is to invoke pip using the same name you are using to invoke python itself. So, for example, from a Terminal window, if you type "python3" to start up Python, use this: python3 -m pip install ntlk If you are still having problems, please copy and paste the full sequence of commands that you are entering and the error messages you see. FWIW, I just tried it with the current Python 3.10.2 macOS installed from python.org and it seemed to work. P.S. general Python usage questions are probably more quickly solved via one of the general help forums out there. See https://www.python.org/about/help/. -- Ned Deily nad at python.org -- [] From nad at python.org Thu Mar 3 16:17:18 2022 From: nad at python.org (Ned Deily) Date: Thu, 3 Mar 2022 16:17:18 -0500 Subject: [Pythonmac-SIG] Hi. I am having difficulty installing NLTK on my Mac (12.02.01). Is there anyone who can help? In-Reply-To: <9AF632E7-D19D-4331-A809-5A71BF9788A8@python.org> References: <34553549-1C22-4E24-AE20-8FD6B077B249@me.com> <9AF632E7-D19D-4331-A809-5A71BF9788A8@python.org> Message-ID: <83BD7170-1E44-4618-80DC-D7C3F430EF3F@python.org> On Mar 3, 2022, at 16:15, Ned Deily wrote: > On Feb 27, 2022, at 15:51, Robert Wasserman via Pythonmac-SIG wrote: >> >> I?ve been learning pylon on my Mac and and am trying to install NLTK so I can try the examples in the NLTK text. >> >> The instructions in NLTK are straightforward and I am able to get Python itself on my computer, but I cannot get ?pip? to work. >> >> I would appreciate any help or sources of help. My problem seems to be getting Python to work on the data provided in the NLTK. > > Sorry but without more information, it is impossible to provide meaningful help. But the most common problem with using pip is trying to use the wrong version of pip. The best way to avoid that is to invoke pip using the same name you are using to invoke python itself. So, for example, from a Terminal window, if you type "python3" to start up Python, use this: > > python3 -m pip install ntlk Er, of course, that should be: python3 -m pip install nltk > If you are still having problems, please copy and paste the full sequence of commands that you are entering and the error messages you see. > > FWIW, I just tried it with the current Python 3.10.2 macOS installed from python.org and it seemed to work. > > P.S. general Python usage questions are probably more quickly solved via one of the general help forums out there. See https://www.python.org/about/help/. -- Ned Deily nad at python.org -- [] From nad at python.org Mon Mar 7 15:26:43 2022 From: nad at python.org (Ned Deily) Date: Mon, 7 Mar 2022 15:26:43 -0500 Subject: [Pythonmac-SIG] Hi. I am having difficulty installing NLTK on my Mac (12.02.01). Is there anyone who can help? In-Reply-To: <92C4679A-0443-4B94-BFEA-39E022BB19EE@me.com> References: <34553549-1C22-4E24-AE20-8FD6B077B249@me.com> <9AF632E7-D19D-4331-A809-5A71BF9788A8@python.org> <83BD7170-1E44-4618-80DC-D7C3F430EF3F@python.org> <92C4679A-0443-4B94-BFEA-39E022BB19EE@me.com> Message-ID: <87FD97A6-78B5-4723-B01B-4D226CF0DF3A@python.org> On Mar 7, 2022, at 14:58, Robert Wasserman wrote: > Thank you so much for responding to my email. I?ve spent hours and searched for other forms of the instructions for using NLTK, You're welcome but, in the future, please reply to the mailing list so that everyone can participate and benefit. I've CC-ed this reply. > Under the lines that loaded Python 10.3.1 Python 10.3.1 Header, I got the >>> prompt and I assumed that I could continue with in Python3 by typing Python or Python3 but neither worked > and the from NLTK.book.import * returned the message printed below > import NLTK and followed that at the next >>> prompt with NLTK.downoad() > > > But did not get the material in Figure (the figure headed with Collectcions , Corpora Models All Packages etc. > > From the >>> prompt tried. >>>from NLTK.book import * > > Long ago, I recall having gone through the same process when using Python2.7 or perhaps 2.5 and got the data and was able to run Python and then the >>>from NLTK.book import *. > > ?and then was able to type the commands such as text1(Moby Dick) and the other texts which I could then use with commands such as >>>text1.concordance(?monstrous?). Etc > > But when I used IDLE and brought up the Python3 prompt, it seemed that Python3 loaded properly but as not able to act on perform commands. The command line responded that > To my effort to type ?from NLTK.book. import * > With. Last login: Sun Mar 6 14:49:42 on ttys000 > (base) robertwasserman at Roberts-MacBook-Pro ~ % python > Python 3.9.7 (default, Sep 16 2021, 08:50:36) > [Clang 10.0.0 ] :: Anaconda, Inc. on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> from nltk.book.import * > File "", line 1 > from nltk.book.import * > ^ > SyntaxError: invalid syntax > >>> The syntax error is from an extra ".". Instead, try: from nltk.book import * -- Ned Deily nad at python.org -- [] From robertwasserman at me.com Mon Mar 7 15:00:52 2022 From: robertwasserman at me.com (Robert Wasserman) Date: Mon, 7 Mar 2022 15:00:52 -0500 Subject: [Pythonmac-SIG] Hi. I am having difficulty installing NLTK on my Mac (12.02.01). Is there anyone who can help? In-Reply-To: <83BD7170-1E44-4618-80DC-D7C3F430EF3F@python.org> References: <34553549-1C22-4E24-AE20-8FD6B077B249@me.com> <9AF632E7-D19D-4331-A809-5A71BF9788A8@python.org> <83BD7170-1E44-4618-80DC-D7C3F430EF3F@python.org> Message-ID: <5F9AFABF-7F4C-48DA-A931-26115852E786@me.com> > On Mar 3, 2022, at 4:17 PM, Ned Deily wrote: > > On Mar 3, 2022, at 16:15, Ned Deily wrote: >> On Feb 27, 2022, at 15:51, Robert Wasserman via Pythonmac-SIG wrote: >>> >>> I?ve been learning pylon on my Mac and and am trying to install NLTK so I can try the examples in the NLTK text. >>> >>> The instructions in NLTK are straightforward and I am able to get Python itself on my computer, but I cannot get ?pip? to work. >>> >>> I would appreciate any help or sources of help. My problem seems to be getting Python to work on the data provided in the NLTK. >> >> Sorry but without more information, it is impossible to provide meaningful help. But the most common problem with using pip is trying to use the wrong version of pip. The best way to avoid that is to invoke pip using the same name you are using to invoke python itself. So, for example, from a Terminal window, if you type "python3" to start up Python, use this: >> >> python3 -m pip install ntlk > > Er, of course, that should be: > > python3 -m pip install nltk > >> If you are still having problems, please copy and paste the full sequence of commands that you are entering and the error messages you see. >> >> FWIW, I just tried it with the current Python 3.10.2 macOS installed from python.org and it seemed to work. >> >> P.S. general Python usage questions are probably more quickly solved via one of the general help forums out there. See https://www.python.org/about/help/. > > -- > Ned Deily > nad at python.org -- [] > From chris.barker at noaa.gov Tue Mar 22 15:47:31 2022 From: chris.barker at noaa.gov (Chris Barker) Date: Tue, 22 Mar 2022 12:47:31 -0700 Subject: [Pythonmac-SIG] Building against OpenGL Message-ID: I have an app that uses a C (Cython) extension that needs to link against the OpenGL libs (libGL and libGLU) Here's the code that used to work: gl_libraries = ["GL", "GLU"] ... gl_include_dirs.append( "/System/Library/Frameworks/OpenGL.framework/Headers", ) gl_library_dirs.append("/System/Library/Frameworks/OpenGL.framework/Libraries", ) And this resulted in this linking line that fails: clang -bundle -undefined dynamic_lookup -Wl,-rpath,/Users/chris.barker/miniconda3/envs/maproom39/lib -L/Users/chris.barker/miniconda3/envs/maproom39/lib -Wl,-rpath,/Users/chris.barker/miniconda3/envs/maproom39/lib -L/Users/chris.barker/miniconda3/envs/maproom39/lib build/temp.macosx-10.9-x86_64-3.9/libmaproom/Tessellator.o -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL -lGLU -o build/lib.macosx-10.9-x86_64-3.9/libmaproom/Tessellator.cpython-39-darwin.so ld: library not found for -lGL clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command '/usr/bin/clang' failed with exit code 1 Some of this makes sense -- as System/Library/Frameworks/OpenGL.framework doesn't have Libraries and Headers anymore. However, it also doesn't have the headers or libraries (that I can tell) anywhere else in there. Oddly, the compiler is finding the headers somewhere -- not sure where. Google has failed me here -- but a few hints: 1) ctypes had to be updated to find the libs -- that was done, and ctypes seems to be working. but what it does is: In [1]: from ctypes.util import find_library In [2]: find_library("OpenGL") Out[2]: '/System/Library/Frameworks/OpenGL.framework/OpenGL' but /System/Library/Frameworks/OpenGL.framework/OpenGL doesn't exist on my system at all. Reading a bit -- it seems that OS-X is doing some kind of cached libs trickery -- but how do I tell distutils / clang how to find those libs?? Enclosed is the whole setup.py in case I've missed a detail. Sometimes Apple Drives me crazy! Thanks for any hints -- -CHB -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: setup.py Type: text/x-python-script Size: 5060 bytes Desc: not available URL: From chris.barker at noaa.gov Tue Mar 22 16:07:11 2022 From: chris.barker at noaa.gov (Chris Barker) Date: Tue, 22 Mar 2022 13:07:11 -0700 Subject: [Pythonmac-SIG] Building against OpenGL In-Reply-To: References: Message-ID: As usual, once you pose the question -- you find the answer. The trick was not to try to link directly, but rather to use Apple's nifty "Framework" concept: extra_link_args.append("-framework OpenGL") Posting this in case anyone else happens upon it. -CHB On Tue, Mar 22, 2022 at 12:47 PM Chris Barker wrote: > I have an app that uses a C (Cython) extension that needs to link against > the OpenGL libs (libGL and libGLU) > > Here's the code that used to work: > > gl_libraries = ["GL", "GLU"] > > ... > > gl_include_dirs.append( > "/System/Library/Frameworks/OpenGL.framework/Headers", > ) > > gl_library_dirs.append("/System/Library/Frameworks/OpenGL.framework/Libraries", > ) > > And this resulted in this linking line that fails: > > clang -bundle -undefined dynamic_lookup > -Wl,-rpath,/Users/chris.barker/miniconda3/envs/maproom39/lib > -L/Users/chris.barker/miniconda3/envs/maproom39/lib > -Wl,-rpath,/Users/chris.barker/miniconda3/envs/maproom39/lib > -L/Users/chris.barker/miniconda3/envs/maproom39/lib > build/temp.macosx-10.9-x86_64-3.9/libmaproom/Tessellator.o > -L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL -lGLU -o > build/lib.macosx-10.9-x86_64-3.9/libmaproom/ > Tessellator.cpython-39-darwin.so > ld: library not found for -lGL > clang: error: linker command failed with exit code 1 (use -v to see > invocation) > error: command '/usr/bin/clang' failed with exit code 1 > > Some of this makes sense -- as System/Library/Frameworks/OpenGL.framework doesn't > have Libraries and Headers anymore. However, it also doesn't have the > headers or libraries (that I can tell) anywhere else in there. > > Oddly, the compiler is finding the headers somewhere -- not sure where. > > Google has failed me here -- but a few hints: > > 1) ctypes had to be updated to find the libs -- that was done, and ctypes > seems to be working. but what it does is: > > In [1]: from ctypes.util import find_library > In [2]: find_library("OpenGL") > Out[2]: '/System/Library/Frameworks/OpenGL.framework/OpenGL' > > but /System/Library/Frameworks/OpenGL.framework/OpenGL doesn't exist on > my system at all. > > Reading a bit -- it seems that OS-X is doing some kind of cached libs > trickery -- but how do I tell distutils / clang how to find those libs?? > > Enclosed is the whole setup.py in case I've missed a detail. > > Sometimes Apple Drives me crazy! Thanks for any hints -- > > -CHB > > > > -- > > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > Chris.Barker at noaa.gov > -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker at noaa.gov -------------- next part -------------- An HTML attachment was scrubbed... URL: From aivar.annamaa at gmail.com Mon Mar 28 04:08:27 2022 From: aivar.annamaa at gmail.com (Aivar Annamaa) Date: Mon, 28 Mar 2022 11:08:27 +0300 Subject: [Pythonmac-SIG] Universal build launches as Intel on M1 Message-ID: Hi! I have an app bundle, with embedded python.org's universal build of Python 3.10.2 framework and a Tkinter-based GUI ( https://github.com/thonny/thonny/releases/tag/v4.0.0b1) I've used IDLE's approach in the Info.plist, and the launcher script. Functionally all is working fine, but a M1 user reported, that when opened from Finder, the app is launched in "Intel" mode. When the launcher is invoked in Terminal (/Applications/Thonny.app/Contents/MacOS/thonny), the app gets run in AMD64 mode. I don't have a M1 myself, so I haven't reproduced it myself. The same user now said that latest IDLE (3.10.4) runs in AMD64 mode even when launched from Finder. Any ideas what to check or try in order to make my app run in native mode? My launcher script template is here: https://github.com/thonny/thonny/blob/master/packaging/mac/Thonny.app.initial_template/Contents/MacOS/thonny (shebang becomes gets set to .../Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python by the postinstall script) Info.plist template is here: https://github.com/thonny/thonny/blob/master/packaging/mac/Thonny.app.initial_template/Contents/Info.plist Best regards, Aivar -------------- next part -------------- An HTML attachment was scrubbed... URL: From jack.jansen at cwi.nl Mon Mar 28 17:05:22 2022 From: jack.jansen at cwi.nl (jack.jansen at cwi.nl) Date: Mon, 28 Mar 2022 23:05:22 +0200 Subject: [Pythonmac-SIG] Universal build launches as Intel on M1 In-Reply-To: References: Message-ID: I can?t check right now (I don?t have a universal Python installed, just to separate intel and M1 pythons), but if you use Finder ?Get Info? on the application bundle: does it show the ?Open using Rosetta? checkbox? If it does: ensure it is unchecked. -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman > On 28 Mar 2022, at 10:08, Aivar Annamaa wrote: > > Hi! > > I have an app bundle, with embedded python.org 's universal build of Python 3.10.2 framework and a Tkinter-based GUI (https://github.com/thonny/thonny/releases/tag/v4.0.0b1 ) > > I've used IDLE's approach in the Info.plist, and the launcher script. Functionally all is working fine, but a M1 user reported, that when opened from Finder, the app is launched in "Intel" mode. When the launcher is invoked in Terminal (/Applications/Thonny.app/Contents/MacOS/thonny), the app gets run in AMD64 mode. I don't have a M1 myself, so I haven't reproduced it myself. > > The same user now said that latest IDLE (3.10.4) runs in AMD64 mode even when launched from Finder. > > Any ideas what to check or try in order to make my app run in native mode? > > My launcher script template is here: https://github.com/thonny/thonny/blob/master/packaging/mac/Thonny.app.initial_template/Contents/MacOS/thonny (shebang becomes gets set to .../Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python by the postinstall script) > > Info.plist template is here: https://github.com/thonny/thonny/blob/master/packaging/mac/Thonny.app.initial_template/Contents/Info.plist > > Best regards, > Aivar > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG at python.org > https://mail.python.org/mailman/listinfo/pythonmac-sig > unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG -------------- next part -------------- An HTML attachment was scrubbed... URL: From nad at python.org Mon Mar 28 17:45:52 2022 From: nad at python.org (Ned Deily) Date: Mon, 28 Mar 2022 17:45:52 -0400 Subject: [Pythonmac-SIG] Universal build launches as Intel on M1 In-Reply-To: References: Message-ID: <30DA75B6-B15A-4B33-9652-319CF5636703@python.org> On 28 Mar 2022, at 10:08, Aivar Annamaa wrote: > I have an app bundle, with embedded python.org's universal build of Python 3.10.2 framework and a Tkinter-based GUI (https://github.com/thonny/thonny/releases/tag/v4.0.0b1) > > I've used IDLE's approach in the Info.plist, and the launcher script. Functionally all is working fine, but a M1 user reported, that when opened from Finder, the app is launched in "Intel" mode. When the launcher is invoked in Terminal (/Applications/Thonny.app/Contents/MacOS/thonny), the app gets run in AMD64 mode. I don't have a M1 myself, so I haven't reproduced it myself. > > The same user now said that latest IDLE (3.10.4) runs in AMD64 mode even when launched from Finder. > > Any ideas what to check or try in order to make my app run in native mode? > > My launcher script template is here: https://github.com/thonny/thonny/blob/master/packaging/mac/Thonny.app.initial_template/Contents/MacOS/thonny (shebang becomes gets set to .../Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python by the postinstall script) > > Info.plist template is here: https://github.com/thonny/thonny/blob/master/packaging/mac/Thonny.app.initial_template/Contents/Info.plist It looks the problem is in your Distribution.plist; change the hostArchitectures to "arm64,x86_64". Otherwise, the macOS installer assumes your app can only run as an Intel binary. https://github.com/thonny/thonny/blob/a9d12ba961eac875dc4a77ac1fb226baf5c3acc9/packaging/mac/Distribution.plist#L9 -- Ned Deily nad at python.org -- [] From aivar.annamaa at gmail.com Tue Mar 29 02:05:59 2022 From: aivar.annamaa at gmail.com (Aivar Annamaa) Date: Tue, 29 Mar 2022 09:05:59 +0300 Subject: [Pythonmac-SIG] Universal build launches as Intel on M1 In-Reply-To: <30DA75B6-B15A-4B33-9652-319CF5636703@python.org> References: <30DA75B6-B15A-4B33-9652-319CF5636703@python.org> Message-ID: Jack and Ned, thanks a lot! I had forgotten about Distribution.plist. Will try the suggested value in the next beta. Best regards, Aivar On Tue, Mar 29, 2022 at 12:45 AM Ned Deily wrote: > On 28 Mar 2022, at 10:08, Aivar Annamaa wrote: > > I have an app bundle, with embedded python.org's universal build of > Python 3.10.2 framework and a Tkinter-based GUI ( > https://github.com/thonny/thonny/releases/tag/v4.0.0b1) > > > > I've used IDLE's approach in the Info.plist, and the launcher script. > Functionally all is working fine, but a M1 user reported, that when opened > from Finder, the app is launched in "Intel" mode. When the launcher is > invoked in Terminal (/Applications/Thonny.app/Contents/MacOS/thonny), the > app gets run in AMD64 mode. I don't have a M1 myself, so I haven't > reproduced it myself. > > > > The same user now said that latest IDLE (3.10.4) runs in AMD64 mode even > when launched from Finder. > > > > Any ideas what to check or try in order to make my app run in native > mode? > > > > My launcher script template is here: > https://github.com/thonny/thonny/blob/master/packaging/mac/Thonny.app.initial_template/Contents/MacOS/thonny > (shebang becomes gets set to > .../Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python > by the postinstall script) > > > > Info.plist template is here: > https://github.com/thonny/thonny/blob/master/packaging/mac/Thonny.app.initial_template/Contents/Info.plist > > > It looks the problem is in your Distribution.plist; change the > hostArchitectures to "arm64,x86_64". Otherwise, the macOS installer > assumes your app can only run as an Intel binary. > > > https://github.com/thonny/thonny/blob/a9d12ba961eac875dc4a77ac1fb226baf5c3acc9/packaging/mac/Distribution.plist#L9 > > -- > Ned Deily > nad at python.org -- [] > > -------------- next part -------------- An HTML attachment was scrubbed... URL: