Loading Packages

I don't think it is ..

OK, now try

install.packages("png")

Okay, png is now installed :slight_smile:

Good! Does that eliminate the error?

I used the following commands

install.packages("png")
remove.packages("IsingFit")
install.packages("IsingFit")
library("IsingFit")

Unfortunately I received the same output

The downloaded binary packages are in
/var/folders/z2/jv3cyfpn285g4kmsb44yzqs00000gn/T//RtmpKHznpL/downloaded_packages

install.packages("IsingFit")
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.0/IsingFit_0.3.1.tgz'
Content type 'application/x-gzip' length 36399 bytes (35 KB)
==================================================
downloaded 35 KB

The downloaded binary packages are in
/var/folders/z2/jv3cyfpn285g4kmsb44yzqs00000gn/T//RtmpKHznpL/downloaded_packages

library("IsingFit")
Error: package or namespace load failed for ‘IsingFit’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so':
dlopen(/Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so, 6): Symbol not found: _inflateValidate
Referenced from: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so (which was built for Mac OS X 10.13)
Expected in: /usr/lib/libz.1.dylib
in /Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so

Is png.so where it is supposed to be? If not, we now know that this is a $PATH problem

I don't think so. I can't seem to locate it

OK. So, if from the terminal

$ ls -l  /Users/harlyjanedurbin/Library/R/4.0/library/png/libs/png.so

is coming up empty, when you installed R did you take the default option to install for all users or did you install to a user-specific directory?

Yes, I just selected the default option :grimacing:

OK, can you run

$ echo $PATH

from the terminal?

Okay, done :slight_smile: This is the message I receive

Bridgets-iMac:~ bridget$ echo$PATH
bash: echo/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/RStudio.app/Contents/MacOS/postback: No such file or directory

Sorry

[the prompt] echo $PATH

Do you mean the expected file path? (Sorry!)

Example - /Library/Frameworks/R.framework/Versions/4.0/Resources/library/png/libs/png.so echo$PATH ?

Sorry this is taking so long to pin down. Let's keep going.

The $PATH variable in your .profile or .bash_profile files in your home directory specify the order in which programs look for things. I was thinking that maybe the old Anaconda stuff was in front of the directory that R packages need.

I'm on my Airbook now, and I don't think that's necessarily the case. I'll dig more and be back a bit later. It's scary how much macOS specific knowledge starts just evaporating after spending time on Linux.

OK; I've found the FAQ and rescrewed my head on:

The main library of packages is the one located inside the R.framework (in /Library/Frameworks/R.framework/Resources/library ). This library contains the packages (base and recommended ones) distributed along with R. Only administrators are allowed to install packages in this system-wide directory. Note that this directory is R-version-specific. Optionally users can install personal packages in their ~/Library/R/x.y/library directory where x.y denotes the R version without the patch level (such as 3.0) – see the startup preferences in R.APP.

The Package Installer performs installation to either place depending on the installation target setting. The default for an admin users is to install packages system-wide, whereas the default for regular users is their personal library tree.

If you use install.packages R function instead of the Package Installer, the regular Unix behavior applies (see help pages for details). For default setup this means that the packages are installed according to the startup preference setting. You can check the current defaults by issuing

.libPaths()

Mine does this

> .libPaths()
[1] "/Users/rc/Library/R/4.0/library"                               
[2] "/Library/Frameworks/R.framework/Versions/4.0/Resources/library"
> 

That means that install.packages() puts things in [1] unless I sudo into an R session, which puts things in [2].

Let's keep narrowing the differences in our setups. Run .libPaths() ?

I must reiterate how thankful I am for your assistance.

I have run .libPaths() and this is what I get ..

.libPaths()
[1] "/Library/Frameworks/R.framework/Versions/4.0/Resources/library"

We're getting there!

The message tells us that the png.so resource is only being looked for in the system directory. It looks like png.so is in your equivalent of

 $ 546:  pwd
/Users/rc/Library/R/4.0/library/png/libs
 $ 547:  l
total 520
-rwxr-xr-x  1 rc  staff   259K Apr 24 04:30 png.so*

Check, please?

I am very, very sorry for my ignorance. How do I check this?

Please, please! I've been doing Unix descendants since 1983--it's still hard.

Again, from the terminal, can you change directories into

/Users/harlyjanedurbin/Library/R/4.0/library

and see if it has png.so

To change the directory in the terminal I have entered the following .. Is this correct (or close to correct)?

Bridgets-iMac:~ bridget$ setwd(/Library/Frameworks/R.framework/Versions/4.0/Resources/library)