zlib/bz2 library and headers are requried for compiling R - r

Trying to compile R-3.3.2 on Debian Jessie, all dependencies are installed. However the ./configure script complains about the zlib/bzip2 library versions not matching with the minimum requirement.
Minimum version required:
zlib: 1.2.6 (installed version: 1.2.11)
bzip2: 1.0.6 (installed version: 1.0.6)

After looking at the parts of configure script checking the library versions, it seems that it compares versions with strcmp or strncmp. Since "1.2.11" is lexicographically smaller that "1.2.6" it return a non-zero value indicating that the match failed. Besides, it just compares the first 5 characters which is also not what it is intented. So, it's a bug in configure script. Changing the script fixed the issue.
For zlib, find this line:
exit(strncmp(ZLIB_VERSION, "1.2.5", 5) < 0);
Change it to:
exit(ZLIB_VERNUM < 0x1250);

I had some issues installing R myself, specifically with the error
checking for BZ2_bzlibVersion in -lbz2... no
I had to install libbz2-dev to get that error to go away.
Unfortunately, I came across a few more issues while running ./configure and had to do a little more digging to find out how to solve it.
Discussion on issue
After reading that, I had realized I had to install a couple packages like libcurl4-openssl-dev, libpcre3, and liblzma-dev to finally finish the configuration.
The cited link suggested
At this stage you could have as well tried to install R 3.2.0RC ...
R-devel has not yet diverged much.
Personally, I think that installing an older version to resolve dependency issues reeks of laziness, but that's just my two cents.

Related

No module named 'charset_normalizer.md__mypyc'

I'm using PyInstaller to compile a program and keep coming across the error "No module named 'charset_normalizer.md__mypyc.'" The Charset-Normalizer package is installed.
As a test, I tried re-compiling a program that I had previously created in early September without issue, but now receive the same error. I thought that maybe there is an issue with the versions of either PyInstaller or Charset-Normalizer so I've experimented with different versions, but cannot get it to work.
You are probably missing the "chardet" library
I installed it and it worked.
pip install chardet
I had the EXACT problem. Scripts that I was able to make into executables using Pyinstaller before I could no longer do so again. In my script I used the pdfplumber package, which when you install it also installs other packages like pillow, wand, charset-normalizer, etc.
Since the error was regarding charset-normalizer for me as well, I tried different versions of it. For me it was version 2.1.0 that made the executable work again. Install it with the "pip install charset-normalizer==2.1.0" command: https://pypi.org/project/charset-normalizer/2.1.0/.
If it does not work, go to "Release history" on that link and try another version. Try to remember when was the last time you created a working executable and get the version you think will work for you.
This worked for me:
I just added
from charset_normalizer import md__mypyc
to the top of my python script.
https://stackoverflow.com/a/58449206/20576777
If you don't have the charset-normalizer library installed, then you should install it using the following command:
pip install charset-normalizer
I got it to work by installing older versions of PyInstaller and Charest-Normalizer. Anytime this messages pops-up, consider installing an older version of the package.
Pyinstaller may sometimes miss your dependency. In such a case run pyinstaller with the --collect-all option.
In this case --collect-all charset_normalizer should force pyinstaller to include the dependency.

Update R 4.0.5 to R 4.1.1 with conda on ubuntu 18.04 [duplicate]

On Ubuntu in a Conda environment with Python 3.7.3, when I run
conda install -c conda-forge opencv
I get OpenCV 3.4.2 (checked with import cv2 and then cv2._version__) even though https://anaconda.org/conda-forge/opencv indicates version 4.11. Why?
Note that I didn't have OpenCV installed previously (I ran conda uninstall opencv and it got completely removed)
tl;dr You likely have previously installed dependencies that need updating. If you require a specific version, say 4.1, then express this to Conda:
conda install -c conda-forge opencv=4.1
Explanation
How Conda Interprets Specifications
A literal translation of the command
conda install -c conda-forge opencv
would go something like
With the conda-forge channel included, ensure that some version of the package opencv is installed in the currently active environment.
The logic here implies that any version it can install would be a valid solution. It also doesn't tell it that it must come from Conda Forge, only that that channel should be included.1
Two-Stage Solve Strategy
Starting with v4.7, Conda uses a two-stage dependency solving strategy. The two stages are
Solve with an implicit --freeze-installed|--no-update-deps flag. This attempts to find the newest version of the requested package that has no conflicts with installed packages. That is, it considers any installation of the package, no matter the version, to be a satisfactory solution. If it works, then it's done. Otherwise, move on to...
An unrestricted solve (what used to be default in Conda < 4.7). This frees up dependencies to be updated and will often result in the latest versions being installed unless there are previous explicit specifications on those packages.2
This strategy aims to provide a faster solve and install experience, by avoiding having to change anything in your environment. It also helps keep the environment stable by avoiding unnecessary version changes.
Specific Failure in Question
What happened in OP's case? One of the dependencies requirements of OpenCV was likely newer in v4.1.1 than what was already installed, but that dependency's version was compatible with installing OpenCV 3.4.2. Hence, the only thing that would change was adding opencv plus missing dependencies. Technically, this is a valid solution since one only asked for some version of opencv to be installed.
Getting the Latest Version
Option: Specifying the Version
If you know you want a specific version then you can always specify it
conda install -c conda-forge opencv=4.1.1
and since Conda can't install this without updating something in your env, the first round of solve will fail, and the full solve will get it for you.
Option: Skip the Freeze
Of course, you may not always know what the latest version number is and don't want to have to look this up on Anaconda Cloud every time. Fortunately, there is the --update-deps flag that essentially skips over the first solve stage and goes straight to the full solve. This will install the latest version for your system, as well as update any of the dependencies.
conda install --update-deps -c conda-forge opencv
Important Note: The --update-deps flag has a side-effect of converting dependencies to explicit specifications. While this is an internal environment state (managed through <env>/conda-meta/history), it does have some behavioral consequences (bugs!):
the result of the conda env export --from-history command will subsequently include all packages, instead of just the ones the user explicitly requested in the past
conda remove will not be able to prune dependencies; e.g., if scipy was installed, it would pull in numpy; if only scipy depended on numpy and scipy was removed, normally numpy would also get removed. This wouldn't work after using the --update-deps flag.
[1]: The behavior here depends on the channel_priority configuration option. With the strict setting, conda-forge would be prioritized over other channels; with the flexible setting, it is simply added to the list and the latest compatible version from any channel is selected.
[2]: One can check the explicit specifications of an environment with conda env export --from-history.

Solve ld linker issues for building R source

While trying to install R from source, I ran into linker issues, in particular: undefined reference to 'u_getVersion_58
I found limited information on this error (eg, this post on the RStudio forum).
Despite running apt-get build-dep, these issues persisted.
It is apparent from these comments by Dirk Eddenbuettel that it relates to libicu versions. I have libicu version 60, while R 3.6.0 and similar recent versions seem to require version 58.
We can install a previous version of libicu from source as follows:
wget http://download.icu-project.org/files/icu4c/58.2/icu4c-58_2-src.tgz
tar -xf icu4c-58_2-src.tgz
cd icu
make
make install
However, make is likely to run into a compilation error due to missing xlocale.h. As indicated on this github post, this can be solved by running ln -s /usr/include/locale.h /usr/include/xlocale.h, as xlocale.h is just a subset of locale.h which was removed from glibc recently. After this, make and make install should succeed for icu version 58, and following that, for R.

SSL and/or TLS Errors

I'm on Mac OSX 10.13.6
If I do:
library("devtools")
install_github(repo = "bryanhanson/ChemoSpec#master")
I get the following error:
install_github(repo = "bryanhanson/ChemoSpec#master") Downloading
GitHub repo bryanhanson/ChemoSpec#master from URL
https://api.github.com/repos/bryanhanson/ChemoSpec/zipball/master
Installation failed: error:1407742E:SSL
routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
I get similar but not identical errors if I try to use pkgdown::build_site() but for now let's set that aside; I think it will prove to arise from the same problem.
I've done a lot of research, and I think the error must reside with one or more of the following: curl, git and/or openssl. I know Mac has its own versions of openssl and curl, and one might need to take steps to access them. My git is up-to-date (2.19.0), I have used Homebrew to update everything it wants to update. This includes curl and openssl but Homebrew does not automatically link to it so as to avoid interfering with the native Mac versions (They are "keg-only"). I have however within R put the Homebrew versions on the path and it doesn't fix the error. R and all R packages are up-to-date.
My research shows this problem has plagued others but none of the solutions have worked. It appears as though the problem is related to deprecated protocols, for instance I've set git config --global --add http.sslversion=tlsv1.2 to no avail.
Finally, this arose about a month ago but I don't know what I did that caused it.
Sorry this is not much to go on. Hopefully some of you experts will know how to troubleshoot.
I'd highly suggest using homebrew to install a proper (Apple is terrible about some kinds of updates) version of curl/libcurl and then re-install the curl and httr packages. (if you do install homebrew, you should also run brew update and brew upgrade on a regular basis).

Installing R on RHEL dependencies - libjpeg

This is pertaining to this question I asked earlier -
Installing R on RHEL 6
So, there were two missing dependencies in installing R on RHEL, texinfo and libjpeg. The first answer to the question solves the texinfo dependency. I set out to solve the libjpeg dependency in a similar manner. A Google search led me to this site -
http://rpmfind.net/linux/rpm2html/search.php?query=libjpeg
However, this one has many rpm files apparently for different flavors of RHEL (?) like alpha, i386, etc. I tried two random rpm's and none of them worked. I tried the apha one and got an error saying not compatible architecture and the i386 one said "--.rpm does not update installed package; Nothing to do". But when I try and install R, it still can't find the libjpeg. So, is there a way to understand if and which rpm from the long list on the above web site I should use so I can install R?
Edit - I went to this link: http://rpmfind.net/linux/rpm2html/search.php?query=libjpeg.so.62(LIBJPEG_6.2)(64bit)
and tried the first rpm. It seemed to work, but required yet another dependency.. libc.so.6 this time
Error: Package: libjpeg62-62.0.0-25.3.x86_64 (/libjpeg62-62.0.0-25.3.x86_64)
Requires: libc.so.6(GLIBC_2.14)(64bit)
And searching for this one on google isn't leading me to the rpm.
https://unix.stackexchange.com/questions/91619/libc-so-6glibc-2-1464bit this would be helpful.
Thanks & Regards,
Alok Thaker

Resources