Re: [Tutor] building package on mac os
Hi Glen, I feel like I would be able to offer you some help but you haven't provided precise enough information for me to know exactly what your problem is. On Mon, 10 Sep 2018 at 00:02, Glenn Schultz via Tutor wrote: > > I have a package that I am working on. I am using Pycharm. The directories > are set up correctly. > In my frameworks I have I guess "frameworks" is a reference to OSX frameworks... Are you using OSX (you need to explain things like this)? > Python 2.7 > Python 3.5 > Python 3.6 > Python 3.7 > Current - which is Python 2.7 So I guess you have installed several framework builds of Python on OSX. > After navigating to the directory with the package I run the following in my > terminal > > python3 setup.py sdist bdist_wheel > > This runs fine and it appears all is correct with no messages or warning. Okay that's good. But which Python is python3? Is it any of the framework builds listed above or is it the OSX system Python? What is the name of the resulting wheel? I expect something like: numpy-1.15.1-cp27-cp27m-manylinux1_i686.whl The name of the wheel is important as it tells you which versions of Python it will work with. > Then I go to the main user directory > and pip install directory/packagename And which pip is this? Does it correspond to the python3 you mentioned? If the wheel you built contains e.g. any C code then it will most likely not be usable with other versions of Python. See the wheel name above... > It appears the wheel installs in a private/var/ folder > > if I change the statement to python3.6 pip install directory/packagename > I get an error 2 cannot find director. I need to change my current python to > 3.6 and also figure out how to install the package. I have seen some > instructions to edit the bash file but before I do this I would like to > resolve the install issue The command gives me the following error: $ python3.6 pip install directory/packagename python3.6: can't open file 'pip': [Errno 2] No such file or directory That's because it's trying to run a Python script called pip but there isn't one in the current directory. I think you want to use the -m switch to invoke the pip *module* that is connected to the Python that you run with "python3.6". So then I get: $ python3.6 -m pip install directory/packagename Invalid requirement: 'directory/packagename' It looks like a path. Does it exist ? This is now running pip for python3.6 but it doesn't work because directory/packagename isn't really the name of a wheel file or of a Python project on PyPI. That may fix your problem provided you put the actual name of the wheel there. -- Oscar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] building package on mac os
On 09/10/2018 05:51 AM, Steven D'Aprano wrote: > Hi Glenn, > > Sorry, I don't think many people here are experts on building packages, > especially on MacOS. You could try the "Python-List" mailing list as > well. > > I know I can't do more than offer a few vague, general questions which > may or may not point you in the right direction. See below. > > On Sun, Sep 09, 2018 at 09:25:10PM +, Glenn Schultz via Tutor wrote: > >> I have a package that I am working on. I am using Pycharm. The >> directories are set up correctly. >> In my frameworks I have >> Python 2.7 >> Python 3.5 >> Python 3.6 >> Python 3.7 >> Current - which is Python 2.7 >> >> After navigating to the directory with the package I run the following in >> my terminal echoing Steven... PyCharm has some support for package construction, but I've never used it; if the problem is particular to that environment, there may be some help available on their forums. >> >> python3 setup.py sdist bdist_wheel >> >> This runs fine and it appears all is correct with no messages or warning. > > Are you running that command as the root user, as a priviledged user > with elevated permissions, or an ordinary user? > > After you run, where is the package installed? > > You have three different Python 3.x versions, which one does python3 > run? > > > [steve@ando ~]$ which python3 > /usr/local/bin/python3 > > [steve@ando ~]$ python3 --version > Python 3.3.0rc3 > > >> Then I go to the main user directory >> and pip install directory/packagename > > What is the main user directory? > > Which user are you running pip as? What version of Python does that pip > work with? > > [steve@ando ~]$ pip --version > pip 8.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7) > > So on my system, "pip" with no given version number relies on Python > 2.7. If your system is the same, then you're running setup using Python > 3 and pip with Python 2, and I have no idea whether or not that will > work. Indeed this is why the recommendation these days is to install as python -m pip install instead of standalone pip install ... that way the pip is sure to match the python, for when you're using a particular virtualenv, etc. > >> It appears the wheel installs in a private/var/ folder Just a thought: wheels are /cached/, if that's what you meant... so if you repeat an operation it doesn't have to be re-fetched. On Linux that is often $HOME/.cache/pip, although it can vary. > What do you mean by "a private/var/ folder"? It would help if you state > the actual path, rather than something that looks like a fake path. If > you want to obfuscate the username, you may change it to something > generic like "fred": > > # real path with amusing Monty Python reference > /home/biggusdickus/.somethingprivate/var/packages > > # more professional sounding path > /home/fred/.somethingprivate/var/packages > > for example. > > >> if I change the statement to python3.6 pip install directory/packagename >> >> I get an error 2 cannot find director. > > > Can you copy and paste the full error message? Are you sure that it > cannot find *director*, or is it *directory*? > > >> I need to change my current python >> to 3.6 and also figure out how to install the package. I have seen some >> instructions to edit the bash file but before I do this I would like to >> resolve the install issue > > What does your OS expect "python" to point to? It is dangerous to change > the system-wide "python" unless you really know what you are doing. > > It should be harmless to use an alias as an ordinary user. Under bash, > you can test it in a shell like this: > > # check that python3.6 does points where you expect > which python3.6 > > # and if so, run this > alias python='python3.6' > > # now confirm python points to Python 3.6 > which python > > > When you are satisfied that works, you can make it permanent by editing > your .bashrc file (under your home directory) and inserting that alias > line. The alias will take effect in any new shells you open (but not > existing shells). You can also use 'pyenv' to manage multiple pythons. It will do some setup magic for you, which can let you switch between versions fairly smoothly. Pycharm has its own mechanism for managing multiple versions, that works fine too, you can assign an interpreter per project (as some of the commentary above suggests you probably know). ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] building package on mac os
Hi Glenn, Sorry, I don't think many people here are experts on building packages, especially on MacOS. You could try the "Python-List" mailing list as well. I know I can't do more than offer a few vague, general questions which may or may not point you in the right direction. See below. On Sun, Sep 09, 2018 at 09:25:10PM +, Glenn Schultz via Tutor wrote: > I have a package that I am working on. I am using Pycharm. The > directories are set up correctly. > In my frameworks I have > Python 2.7 > Python 3.5 > Python 3.6 > Python 3.7 > Current - which is Python 2.7 > > After navigating to the directory with the package I run the following in > my terminal > > python3 setup.py sdist bdist_wheel > > This runs fine and it appears all is correct with no messages or warning. Are you running that command as the root user, as a priviledged user with elevated permissions, or an ordinary user? After you run, where is the package installed? You have three different Python 3.x versions, which one does python3 run? [steve@ando ~]$ which python3 /usr/local/bin/python3 [steve@ando ~]$ python3 --version Python 3.3.0rc3 > Then I go to the main user directory > and pip install directory/packagename What is the main user directory? Which user are you running pip as? What version of Python does that pip work with? [steve@ando ~]$ pip --version pip 8.1.2 from /usr/local/lib/python2.7/site-packages (python 2.7) So on my system, "pip" with no given version number relies on Python 2.7. If your system is the same, then you're running setup using Python 3 and pip with Python 2, and I have no idea whether or not that will work. > It appears the wheel installs in a private/var/ folder What do you mean by "a private/var/ folder"? It would help if you state the actual path, rather than something that looks like a fake path. If you want to obfuscate the username, you may change it to something generic like "fred": # real path with amusing Monty Python reference /home/biggusdickus/.somethingprivate/var/packages # more professional sounding path /home/fred/.somethingprivate/var/packages for example. > if I change the statement to python3.6 pip install directory/packagename > > I get an error 2 cannot find director. Can you copy and paste the full error message? Are you sure that it cannot find *director*, or is it *directory*? > I need to change my current python > to 3.6 and also figure out how to install the package. I have seen some > instructions to edit the bash file but before I do this I would like to > resolve the install issue What does your OS expect "python" to point to? It is dangerous to change the system-wide "python" unless you really know what you are doing. It should be harmless to use an alias as an ordinary user. Under bash, you can test it in a shell like this: # check that python3.6 does points where you expect which python3.6 # and if so, run this alias python='python3.6' # now confirm python points to Python 3.6 which python When you are satisfied that works, you can make it permanent by editing your .bashrc file (under your home directory) and inserting that alias line. The alias will take effect in any new shells you open (but not existing shells). Hope this was helpful. -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor