Rose_Trojan
Rose_Trojan

Reputation: 117

pip refusing to install in conda environment

I am trying to install transformers and simple transformers in a Conda environment in Ubuntu. I have a code that was written on a different system which uses simple transformers which I am trying to run on our server. I am using this tutorial for it - simple transformers. The code I'm trying to run uses python 3.7, but we have python 3.8 on our system, hence the reason why I wanted to set it up in a different environment, along with its dependencies.

I have implemented the following -

conda create -n esInnov python=3.7 pandas tqdm
conda activate esInnov
conda install pytorch cpuonly -c pytorch
conda install -c anaconda scipy
conda install -c anaconda scikit-learn

However, in these next steps which use pip, I have run into problems. pip is refusing to install the following packages in the conda environment I've created and activated - esInnov

pip install transformers
pip install tensorboardx

I have tried all the options given in these posts on stack overflow:

conda environment pip is trying to install dependencies globally

and

Wrong pip in conda env

but nothing seems to be working and I'm now out of ideas. I have tried

which pip and it gives the right path for pip in the conda environment -

/data/anaconda3/envs/esInnov/bin/pip

but the packages are not being installed. I also tried using - conda install pip but it still goes back to the home directory when I try to pip install transformers -

/home/myname/.local/lib/python3.8/site-packages/pip/

Commenting out the pythonpath in .bashrc has also not made any difference.

Does anyone have any suggestions?

Upvotes: 2

Views: 2919

Answers (1)

Rose_Trojan
Rose_Trojan

Reputation: 117

This has now been resolved. I went into the pip config file which a colleague had created and commented out the global target which was set to the home directory, hence overriding the environment pip target. This solved the problem.

To change the pip config file, I used - nano $HOME/ . config/pip/pip.conf

Upvotes: 1

Related Questions