0

Is it possible to install glmnet in python 2 or 3 (windows machine):

Using this:

 conda install glmnet

produces this error:

 packages not found error: ... not available from current channels

Does anyone experience similar problems?

edit: Using pip gave me this error:

failed with error code 1
Niccola Tartaglia
  • 1,537
  • 2
  • 26
  • 40

3 Answers3

2

According to the anaconda cloud website glmnet package the available version for mac and Ubuntu users. It's not available yet for Windows users. The only way is to install the r version of it with anaconda r-glmnet.

conda install -c r r-glmnet 
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
1

The documentation says you should install using either:

conda install -c conda-forge glmnet

or

pip install glmnet

EDIT:

It seems there are multiple "glmnet" packages for python that go by different names. Here is another: https://github.com/conda-forge/r-glmnet-feedstock

To install that one you just do:

conda install -c conda-forge r-glmnet

Either way, the key is to specify which channel you want to install from using the -c flag followed by the channel name (conda-forge), and then the correct name for the package you want

Alternatively, instead of specifying the channel name every time you want to install something, you can add conda-forge to your config with:

conda config --add channels conda-forge

Then you no longer need to use -c and can just install packages with:

conda install r-glmnet

or conda install glmnet

Simon
  • 9,762
  • 15
  • 62
  • 119
1

This is how I succeeded:

  1. You need a fortran compiler. If you're a student (like me), you can get it from intel for free: https://software.intel.com/en-us/qualify-for-free-software/student

  2. Clone the repo for https://pypi.org/project/glmnet/ from https://github.com/civisanalytics/python-glmnet.

  3. Launch the fortran compiler environment in a command prompt

  4. Navigate to the folder where you cloned the repo

  5. Activate the conda environment you want to install glmnet into

  6. Run python setup.py install

The package will now be available as glmnet_python

florian
  • 31
  • 6