PIP is linked only to system environment - bash

I'm using pyenv-virtualenv on Ubuntu 16.04 LTS.
While I was installing imblearn package for my virtualenv using Python 3.5, I realized it was being installed on system environment which uses Python 2.7. I checked with pyenv version but it clearly returned that I was on my virtualenv.
I opened a Python shell and tried to import imblearn and got ImportError: No module named 'imblearn'.
When I checked with pip list, it clearly stated that imblearn was installed. But every other packages that have been installed were missing, hence telling that the list was of system environment.
I've tried making a new environment and checked but the list is still of system and installation goes to system as well.
My pip is stuck with system.
I have never experienced this before and have no idea how to fix this.
Below is my .bashrc setting:
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Just the way it tells me to set.
I've been using it fine until yesterday which I found out this was happening.
I suspect it has something to do with pyenv global command which I used while I was telling my partner how to use pyenv-virtualenv yesterday.
Still, I have never had a problem with that command before.
Please help.
Update
For some reason, source ~/.bashrc put everything back to normal. (I don't know why I typed this command. I just did it.)
But I'd still like to know how this happened and why it is fixed when I changed nothing in my .bashrc file and when even re-opening terminal or rebooting didn't fix things.

I still don't know how this was solved, and assume that this won't happen in later version pyenv-virtualenv.
It's a year old post, but I guess I could post what helped me back then so that others won't try to solve my long ago problem for me.
Thanks for letting me know.
source ~/.bashrc

Related

How to install anaconda through home-brew m1 mac

I just got an m1 Mac and installed anaconda using home-brew:
brew install anaconda
It looked like it worked great, except that when I actually go to use anaconda and type "conda" I get the dreaded "conda command not found" error. How do I fix this?
Based on the answer given by #Peter here as well as the anaconda documentation, adding to path is no longer recommended. The answers here also did not solve the problem.
Figured it out! Challenge lay in the home-brew path. To run the conda init zsh command, detailed by #Sebastian in the answer here, I had to specify home-brew, as well as back up a couple directories. The command that actually got it done in terminal was:
~/../../opt/homebrew/anaconda3/bin/conda init zsh
Happy home-brew anaconda-ing on your new m1s everyone.

Mas OS Big Sur update - Python3 / conda / pip not found

Sorry if this is a stupid question. I use python/jupyter a lot and it's stopped working after updating from Mac OS High Sierra to Big Sur. I'm trying to figure out why, but I'm not great with command line stuff.
The problem. When I try python3, pip -v, conda, etc. it says "command not found". python still seems to run, but it's 2.7 and I know I had 3 (I probably had a few versions from untidy file systems). I want to avoid reinstalling all my packages and things again, because I know it's still there and I've done this a few times already.
Some clues. I know this OS upgrade moves me from bash to zsh. I've tried just switching back to bash with chsh -s /bin/zsh but it still says command not found. I also noticed the OS update creates a Mac HD (below System/Volumes) within my Mac HD, and in that second one seems to be still all my python3/conda/pip/etc. folders. Not sure if/how this matters. Or if this is just a path issue.
I just want to get Jupyter running again on my Mac without reinstalling all my myriad packages from square one. Any help appreciated!
After extreme toil and research, I finally found something that worked for me.
Find the location of your Anaconda3. For me it was in ~/opt/anaconda3
Open terminal and type source <location of anaconda3>/bin/activate and then in the next line, write conda init zsh
Close your terminal and open it again. You should see a prefix (base) when you open it again.
All in all, for me it was
rko3 ~ % source opt/anaconda3/bin/activate
rko3 ~ % conda init zsh
Let me know if this works for you!
PS. You may be tempted to change $PATH variables. Anaconda advises against that. Use this reference instead that suggests the above. https://docs.anaconda.com/anaconda/install/mac-os/
I've just resolved this exact issue on my machine after upgrading to Big Sur from Mojave.
The issue: MacOS, as of Catalina, no longer lets you use the system root folder. Anaconda used to install in this folder. After upgrading from Mojave to Big Sur, you'll likely find your anaconda3 folder, including all your environments and packages, located here: /System/Volumes/Data/anaconda3.
Here is what to do to fix it:
Open Terminal
Move the anaconda3 folder:
sudo mv /System/Volumes/Data/anaconda3 ~/
Download Anaconda's Conda Prefix Replacement (crp) tool:
curl -L https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe -o cpr && chmod +x cpr
Run the CRP tool (this will take a few minutes):
./cpr rehome ~/anaconda3/
Source anacoda3
source ~/anaconda3/bin/activate
Initiate conda
conda init
Quit Terminal and open it again.
Edit: Someone didn't like that I ended this answer with "That's it! Enjoy". In the scenario described, the steps above were indeed all it took to resolve the issue. If you're experiencing the same issue, I hope this helps resolve it, so you can get back to enjoying your updated OS.
Seems like your environement is not activated. Zsh sources ~/.zshrc while bash sources ~/.bashrc.
You can copy lines related to conda from your ~/.bashrc to your ~/.zshrc.
AF
Open the Anaconda navigator and click on the Environments section. There you will see the base (root) and a green triangle next to it.
Click on the triangle and select Open Terminal.
Now, in the terminal you will be already in the necessary directory for anaconda and you can then update any packages.
For example, just by writing conda update --all you can update all packages available for updates.

Cannot resolve "rbenv init" instruction for zsh and oh-my-zsh on Mac

I'm a Ruby developer setting up my local development environment on a new iMac running macOS High Sierra with iTerm2, Homebrew, rbenv, zsh and oh-my-zsh.
I used RVM before on my Linux machine, but want to switch to rbenv with this iMac because I've heard it's better in some ways, so I'm trying to make sure all is as it should be with my rbenv setup before I start downloading/installing Rails and other gems.
I'm running rbenv init, which, as I understand it, will tell me what I need to do next to get rbenv working. It displays this message:
# Load rbenv automatically by appending
# the following to ~/.zshrc:
eval "$(rbenv init -)"
So I went into my .zshrc file and added that line. My .zshrc file currently looks exactly like this (comments omitted):
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
export ZSH="/Users/christian/.oh-my-zsh"
plugins=(git)
source $ZSH/oh-my-zsh.sh
No matter how many times I restart my iTerm terminal and run rbenv init, it always gives me that same instruction, and nothing else.
The first line in the file used to be: export PATH=$HOME/bin:/usr/local/bin:$PATH but I changed it to the current line because another StackOverflow page suggested this to someone having a very similar problem, but it didn't help.
I don't understand why it keeps telling me to add something that's already in the .zshrc file, and I don't know whether I've successfully setup rbenv with everything and am ready to start developing in Ruby on Rails.
I've looked at lots of stuff about this on here and other sites, but I can't seem to find the answer. I would be very grateful if someone could tell me why it keeps giving me that same message? how I make it proceed with the instructions and tell me the next thing to do? and how I'll be able to tell for sure when my rbenv is properly setup for development?
I eventually ran curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash and it showed green for everything. It seems I had everything already setup correctly; the rbenv init interface was just confusingly telling me to do something I'd already done. I confirmed it was all working by downloading different versions of Ruby with rbenv install, switching between them with rbenv local and rbenv global, and making sure ruby -v always displayed whatever version I had selected.

ModuleNotFoundError Despite Installing with pip

mac os Catalina, python3.8.2
Hey All,
I know there are similar questions about this, but they didn't seem to help me. I installed a module (quandl) using pip3.8 install. Then I try to import quandl in a .py file and get a ModuleNotFoundError. I do have multiple versions of python installed, can't figure out how to get rid of them safely, hence why I used pip3.8 install to make sure it points to the write place. Still no dice. I am not using a venv.
From the terminal, this is the pip3.8 install path: /usr/local/lib/python3.8/site-packages
From the .py file via VScode, I am interpreting using: /usr/local/bin/python3.8
Can someone educate me on what I am doing wrong?
I was previously interpreting from /Library/Frameworks/Python.framework/Versions/3.8/bin/python3, but I noticed pip was not installing there.
At the bottom of your VSCode window, there's an orange status bar. Starting at the far left, you'll see your git repo info, the git status, and then the Python environment you're using. If you click that, VSCode will slide in a modal dialog window that'll let you choose your python environment -- my VSCode defaulted to /usr/bin/python3, but my pip3 (and python3) are in /usr/local/bin. Once I picked the correct interpreter, I stopped getting the ModuleNotFoundError

How to Fix Entry Point Not Found while installing libraries in conda environment

I'm working on Anaconda by making multiple environments in it. I have made an environment camelot and now I want to install different libraries in this environment. So for example to install pandas in this environment,
I'm writing:
conda install pandas
or
conda install -c conda-forge camelot-py
Then it gives me this error:
python.exe-Entry Point Not Found
The procedure entry point OPENSSL_sk_new_reserve could not be
located in the dynamic link library.
C:\Users\abc\Anaconda3\Library\bin\libssl11_-x64.dll
First I thought it may be because of the environment variable, thus I set an environment variable for Python, but this did not resolve the issue.
as it is suggested in here I could solve this problem by copying libssl-1_1-x64 dlls in Anaconda/DLLS to Anaconda/Library/bin (probably replacing it)
I got the same issue while updating Anaconda navigator, and got it over by replacing the file libssl-1_1-x64.dll in Anaconda3/Library/bin with the one from Anaconda3/DLLs.
As mentioned by an Anaconda maintainer here ...
moving libssl dlls around like that is really not advisable. Those
DLLs are duplicated because you have something fishy going on in your
packages. There should not be any openssl DLLs in the DLLs folder.
They should be in Library/bin
By looking at the JSON files in the conda-meta directory I found out that DLLs\libssl-1_1-x64.dll was installed by the python 3.7.0 package, and Library\bin\libssl-1_1-x64.dll was installed by the openssl package. After further investigation I found out that Python 3.7.0 does not install OpenSSL as a separate package, but Python 3.7.1 (and later) does.
Typically upgrading Python goes as expected, but if you somehow end up with both python 3.7.0 and openssl packages installed simultaneously there will be two libssl-1_1-x64.dll files and your Anaconda distribution will be broken. (You can easily verify this with the conda list command.)
I think the best way to fix it is therefore:
Rename Library\bin\libssl-1_1-x64.dll to Library\bin\libssl-1_1-x64.dll.org (your are going to need it later.)
Copy DLLs\libssl-1_1-x64.dll to Library\bin\libssl-1_1-x64.dll
Update Python to version 3.7.1 or higher, for instance with conda update python. This will remove the DLLs\libssl-1_1-x64.dll file.
Delete the current Library\bin\libssl-1_1-x64.dll file.
Rename Library\bin\libssl-1_1-x64.dll.org back to Library\bin\libssl-1_1-x64.dll. This is necessary because I got HTTP errors in the next step otherwise.
Reinstall OpenSSL with conda install openssl --force-reinstall to ensure it's up to date again.
I had the exact same issue, and it also just started today. Kind of destroyed my entire work day, tbh...
I accidentally did a conda install ... in my base environment, and it updated conda and a handful of other modules. (Conda went from 4.5.12 to 4.7.10, in my case.) Anyway, after I rolled it back, things are working as expected again.
If this is what's causing your issue, here's a fix.
conda list --revisions
conda install --revision 1 (In my case "rev 1" was my most recent, stable base environment.)
(More details about this: https://sriramjaju.github.io/2018-05-30-2-minute-recipe-how-to-rollback-your-conda-environment/)
Now I'm worried that I've inadvertently configured something in a way that isn't compatible with the newest version of conda.
Edit: Don't follow this last suggestion if you're doing anything other than playing around in a conda environment to test-drive modules. See this and this.
Lastly, if you really need to install modules and do some work ASAP, pip install [module name] was still working for me before I thought to do the reversion thing.
My problem was same. I just uninstalled anaconda, and install it again. And the problem solved.
I was receiving the same following error while updating spyder and conda package.
python.exe-Entry Point Not Found
The procedure entry point OPENSSL_sk_new_reserve could not be
located in the dynamic link library.
C:\Users\abc\Anaconda3\Library\bin\libssl11_-x64.dll
solution:
I did replace libssl-1_1-x64 dlls from Anaconda/DLLs to
Anaconda/Library/bins as suggested here.
Before opening Anaconda Navigator desktop app, I updated conda in Anaconda Prompt using conda update conda. conda successfully updated.
Then I have updated spyder using conda update spyder command in
Anaconda Prompt. spyder updated and running successfully.
For those still having similar issues with libssl11_-x64.dll or other .dll files:
Use pip install instead if you can!
I had the same issue today with libcrypto-1_1-x64.dll when trying to install plotly using
conda install -c plotly plotly
This prompts a downgrade for anaconda, and in turn raises the error:
OPENSSL_sk_new_reserve [...] libcrypto-1_1-x64.dll
Instead, using for example
pip install plotly==4.1.0
works like a charm!

Resources