Mod:Hunt Research Group/MacPorts

From ChemWiki
Revision as of 10:23, 13 April 2019 by Phunt (Talk | contribs) (MacPorts)

Jump to: navigation, search

MacPorts

  • installing MacPorts
  • find installation information here link
  • find general information here link
  • download and follow the instructions
  • macport installs in /opt/local so add to your path "export PATH=/opt/local/bin:/opt/local/sbin:$PATH"
  • after a major OS upgrade you will need to install a new MacPorts
  • using MacPorts basic commands
  • you will need to run all commands as sudo
  • general commands
port version
sudo port selfupdate
port installed
port outdated
port upgrade
port uninstall code_name
port activate code_name
  • search for particular codes, in this case for python versions, generally or installed on this machine
port search --name --line --glob 'python*'
port installed 'python*'
port select --list python
port select --set python3 python37
port select --set python2 python27
port select --set python python37 or which ever version you want
do the same for pip
port search --name --line --glob '*pip'
port install py27-pip
port install py37-pip
port select --set pip2 pip27
port select --set pip3 pip37
port select --set pip pip37 or which ever version you want
  • problems

python versions

the Mac (Sierra) has a preinstalled version of python in /user/local/bin
the Mac (Mojave) has a preinstalled version of python in /user/bin
python.org installs in /Library/Frameworks/Python.framework/Versions/3.5/bin and so on
macports installs in /opt/local/bin


to find out which version is being used type "which python"
to find out the version of python used "python -V"
or "python --version"


to ensure the macports version is used in your $PATH make sure /opt/local/bin occurs before /user/bin
sometimes other initiating files add things to your path, so key an eye on this variable
choose in what order to search the relevant directories

for example

   export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
   export PATH=$PATH:/Users/$USER/bin
[tricia@clove]/Users/tricia $ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/tricia/bin
[tricia@clove]/Users/tricia $

pip versions

pip3 --version delivers 3.5 and not 3.7
which pip shows /opt/local BUT pip3 shows /usr/local
so pip3 is from the wrong installation of python
sudo port select --set pip pip27 works BUT sudo port select --set pip3 pip37 fails!
so force the use of python3: sudo -H python3 -m pip install .