JPEG2000 Losses Read DICOM in Python 3.7 - dicom

In my Python 3.7, I want to read DICOM. But I face this notification:
NotImplementedError: this transfer syntax JPEG 2000 Image Compression
(Lossless Only), can not be read because Pillow lacks the jpeg 2000
decoder plugin.
I've tried this solution, but anaconda prompt gives me this:
failed
UnsatisfiableError: The following specifications were found to be in
conflict:
- gdcm -> python=3.6 -> python_abi=[build=*_cp36m] -> pypy[version='<0a0']
- python=3.7
Use "conda search --info" to see the dependencies for each
package.
What should I do?

I'm not an expert in conda, but it doesn't look like there are any versions of GDCM available on conda forge for Windows with Python 3.7+, you'll need to stick with 3.6.
If you want to use Pillow with the JPEG2k plugin with conda then you should conda install -c conda-forge openjpeg before installing pillow (see the pydicom installation instructions).

Related

Is there any auto-completion for R in jupyterlab?

Kite can only auto complete python code in jupyterlab.
Is there a similar plug-in that allows R code to be automatically completed?
Thanks.
Yes, jupyterlab-lsp offers auto-completion (along other IDE features). It uses Language Server Protocol which requires you to install both:
one or more language servers (for R use R language server), and
an extension to JupyterLab (jupyterlab-lsp).
and then to enable continuousHinting option in Code Completion settings (via Advanced Settings Editor).
If you use JupyterLab 3.0 installed via conda it is as simple as:
conda install -c conda-forge 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp jupyter-lsp-r
If you use JupyterLab 3.0 installed via pip instead:
pip install 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp
R -e 'install.packages("languageserver")'
install nbextentations for jupyterlab.
nbextentations already have lightweigt auto complete add-on.lightweigth but enough for me.
link: https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html

Install R packages using conda via an environment.yml file

Normally I create conda environments like...
conda env create -f environment.yml
conda activate env_name
Normally I work in Python, where a typical environment.yml simple file might looks like this...
name: env_name
dependencies:
- python=3.7
- pip=19.3
- pandas=0.24.2
- pip:
- scipy==1.2.1
What should the environment.yml file look like to install R packages? The packages are on CRAN
A general rule of thumb is that most R packages have corresponding packages in Anaconda Cloud with the prefix r- added. While the defaults channel covers commonly-used packages, the conda-forge channel has the most thorough coverage of CRAN and has helpful scripts for adding new ones. I would generally recommend prioritizing conda-forge when creating R environments.
For bioinformaticians, all Bioconductor packages are available through the bioconda channel, with a bioconductor- prefix and lowercase. For example, SingleCellExperiment is packaged as bioconductor-singlecellexperiment.
A good place to start is simply searching Anaconda Cloud (example search).
Example
Let's assume you want the tidyverse umbrella package and wish to use R v4.1. A YAML for this would be
name: my_r_env
channels:
- conda-forge
dependencies:
- r-base=4.1
- r-tidyverse
Additional Notes
Avoid using install.packages() from within any R sessions - it is prone to dynamic linking issues due to the R instance's unawareness of compiling inside the environment. This is not an issue for pure R packages, but in that case it should be simple to add the package to conda-forge (takes about 15 mins of work and a ~12-24hr turnaround, IME).
Avoid the RStudio packages from Conda - it is an abandoned project and the old versions are incompatible with newer R versions. This may change once RStudio switches from Qt to Electron. Still, there are better ways to load an environment into RStudio, without having to install the full IDE inside the environment.

How to force `conda` to install the latest version of `jupyter`?

This question is motivated by `jupyter notebook` gives error: `"Could not open static file ''"` on macOS
After conda update jupyter, jupyter --version gives jupyter-notebook : 6.0.0
However on https://github.com/jupyter/notebook, clicking Branch: master -> tags I see a 6.0.1 tag.
How can I upgrade to 6.0.1?
> conda install jupyter=6.0.1
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- jupyter=6.0.1
Current channels:
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
I can't see any candidates on https://anaconda.org
Is this a dead-end?
First, note that the actual package you want to upgrade/install is notebook, not jupyter. The Anaconda channel hasn't released that version of notebook yet. Conda Forge has it, so you can get it with
conda install -c conda-forge notebook
However, just be aware that compatibility between Conda Forge and Anaconda package builds is not guaranteed. Best practice is to create a new env that prioritizes Conda Forge from the start:
conda create -n my_jupyter_env -c conda-forge jupyter
Generally it isn't a good idea to mess with base env, and if you want something other than a default Anaconda install, I recommend starting with Miniconda and leaving base alone (other than the occasional conda upgrade conda).

Offline r-base installation on SLES12.3

We need to install R-base version 3.5+ on an offline machine running SLES12.3
We have downloaded all the packages from the the SUSE r repo
http://download.opensuse.org/repositories/devel:/languages:/R:/released/openSUSE_12.3/x86_64/
while running zypper install on the packages there are additional dependencies that we are not able to find the relevant packages to download.
These include:
libtcl8.5.so()(64bit)
libgomp.so.l()(64bit)
But we are not able to find the dependency package that include these libraries.
What should be the correct approach for installing these libraries offline? where can we find these libraries?
Is there a better way for offline installing R-base ? we tried to follow the instructions on the cran rstudio page
The files you downloaded don't match the distribution you're running. SUSE Linux Enterprise (SLE) and openSUSE are similar in some ways, but these are really two separate distributions and you can not always mix binaries between the two. To install R on SLE Server 12.3, you should use the repository https://download.opensuse.org/repositories/devel:/languages:/R:/released/SLE_12/.
You can find out these URLs by looking at the right hand-side column at https://build.opensuse.org/project/show/devel:languages:R:released. Look for things called "SLE" there.
Install the Development Tools, according to this answer
zypper install --type pattern Basis-Devel
Download R source and install it
wget http://cran.univ-paris1.fr/src/base/R-3/R-3.5.0.tar.gz
tar zxf R-3.5.0.tar.gz
cd R-3.5.0
./configure --enable-R-shlib
make
make check
make install
Maybe there are still dependencies missing, which need to be installed with zypper (I don't have any Suse to try myself). With this method you have an "empty" R and you will install R packages one by one (with R CMD INSTALL). Maybe not the best answer for your need, but an answer.

What directory should packages/modules be written to?

When installing GLPK from (from https://www.gnu.org/software/glpk), I get the following error:
libtool: install: /usr/bin/install -c .libs/libglpk.36.dylib /usr/local/lib/libglpk.36.dylib
install: /usr/local/lib/libglpk.36.dylib: Permission denied
I have tried installing to other locations successfully, but python does not find the package. I would like to run. Note: I am using Enghought Canopy to run Python on Mac OS X version 10.9.4.
You don't install a non-python package into Python. You install it on your system (not a python issue, maybe someone else will have a suggestion), and then install a python package which "wraps" it -- provides access to it in python. If you have already successfully installed GLPK, then you should simply be able to open a Canopy Terminal window from the Canopy Tools menu, and type:
pip install glpk
EDIT: It looks like this is the best place for examples of using it: http://www.tfinley.net/software/pyglpk/examples.html

Resources