I can not install OpenMDAO - anaconda3

I have installed Anaconda since it was recommended to use in the OpenMDAO's website. After that I typed pip install 'openmdao[all]' as instructed. However I get an error message saying, "ERROR: Invalid requirement: "'openmdao[all]'"" I was wondering how can I solve this issue. I have no knowledge about the Python or anaconda therefore I don't have a clue what to do about this situation. I searched the internet however I didn't find a solution to this. Thanks in advance!

It's possible you're running the wrong pip executable. Try which pip - it should be located under your home directory instead of a system path such as /bin/pip or /usr/bin/pip.
Make sure you've created and activated an environment in Anaconda:
conda create -n myenv pip
conda activate myenv
python -m pip install 'openmdao[all]'
That command sequence will give the highest chance of success. The single quotes are required for shells like zsh.

Remove the single quotes:
pip install openmdao[all]

Related

powershell and conda: conda activate env returns command not found

I have pip installed powerline-shell in my base conda env. Switching envs yields the following error:
conda activate <env_name>
-bash: powerline-shell: command not found
I also tried running conda init powershell but it took no actions.
I have miniconda3, with conda 4.7, installed on MacOS Mojave.
I don't know a simple solution to this. I'm thinking you either need to install it in every env (which I don't recommend because it's best to avoid using pip in Conda) or you create a link to the powerline-shell binary in another location that you can keep on PATH to avoid adding the entire miniconda3/bin/ directory to PATH. I've done something like this in the past, but never with a Python entry point before.
I'd try something like
mkdir -p ~/.local/bin
ln -s /your/path/to/miniconda3/bin/powerline-shell ~/.local/bin/powerline-shell
Then add .local/bin to PATH in your .bashrc, probably toward the beginning (e.g., before the Conda section). The path here (~/.local/bin) is totally arbitrary, so adjust to your preferences. Main point is to minimize what you are exposing globally in a shell session.
Note: conda init powershell is for Windows PowerShell users.

Install conda package from Google Datalab

I'm looking to use the ospc taxcalc package in a Google Datalab notebook. This package must be installed via conda.
Datalab doesn't have conda by default, so this method (from https://stackoverflow.com/a/33176085/1840471) fails:
%%bash
conda install -c ospc taxcalc
Installing via pip also doesn't work:
%%bash
pip install conda
conda install -c ospc taxcalc
ERROR: The install method you used for conda--probably either pip install conda or easy_install conda--is not compatible with using conda as an application. If your intention is to install conda as a standalone application, currently supported install methods include the Anaconda installer and the miniconda installer. You can download the miniconda installer from https://conda.io/miniconda.html.
Following that URL, I tried this:
%%bash
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh
wget works, but the bash command to install just kept in "Running..." state for seeming perpetuity.
This seems to be due to the conda installer prompting for several Enter keystrokes to review the license, and then for a yes indicating acceptance of the license terms. So conda's silent mode installation looked promising:
%%bash
bash Miniconda2-latest-Linux-x86_64.sh -u -b -p $HOME/miniconda
This produced the following warning:
WARNING: You currently have a PYTHONPATH environment variable set. This may cause unexpected behavior when running the Python interpreter in Miniconda2. For best results, please verify that your PYTHONPATH only points to directories of packages that are compatible with the Python interpreter in Miniconda2: /content/miniconda
And doesn't make available the conda command:
%%bash
conda install -c ospc taxcalc
bash: line 1: conda: command not found
There is a pending github issue tracking this work - https://github.com/googledatalab/datalab/issues/1376
I believe we will need to install conda and use that for python, pip and all other python packages, and in the interim it may not be possible to mix the two python environments. However someone with more experience with conda might know otherwise.
As of the 2018-02-21 release, Datalab supports Conda and kernels are each in their own Conda environment.

There is no activate when I am trying to run my virtual env

1) I installed virtualenv using pip.
2) I ran the command virtualenv venv
3) Then I ran source venv/bin/activate but it says that there is no such file or directory.
When I cd into venv/bin I find 3 things - python, python 2.7, and python 3.5. Does anyone know the problem?
i have had the same problem. and what i did is just run the command
virtualenv env
again. And then more files were generated under directory env/bin, including the activate file. it's so weird.
I solved the similar problem running python3.7 -m venv venv, you can change for your version of python that is installed in your enviroment.
According to Python doc, the installation step is
$ python3 -m pip install --user virtualenv
$ python3 -m venv env
The last command gives a warning message,
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
$ sudo apt-get install python3-venv
Now, activate is available.
I solved a similar problem by naming it venv2 when I ran virtualenv. I already had a virtual environment named venv for another project. This allowed me to proceed.
I experienced this problem when using the --upgrade option. Removed the option, and all ran as expected.
I double it is caused by some networking issue, I run it twice to get 'activate' script installed. Maybe first it can't connect to some source so it just abort installation.
I had this happen on rasbian when I hadn't installed python3-pip before creating the venv.

Installing with PIP in virtualenv?

I'm trying to wrap my head around virtualenv and pip still.
If I use pip to install a library, it doesn't matter where I 'cd' to, because it installs the libraries in the same place right (which i dont even know where that is)? So I guess my question is, when I install something with pip, how do I make sure it only installs that library inside of my virtual environment? Do I need to cd to that directory first? or is there a command I'm supposed to use with pip to make sure it only installs to the virtualenv project I'm working in?
Activate virtualenv first:
source virt_name/bin/activate
Then after that, install the libraries:
pip install module_name
Note: Don't use sudo with pip because sometimes it will assume you want to install in /usr/local/lib/site-packages.
Generally speaking, if you do not use virtualenv --system-site-packages to create your virtualenv, you should be only working with your per-environment packages.
Providing you run the activate script before installing anything.
i.e. Do the following, if you want to install something in your virtualenv.
Run activate script
Windows: [ve_directory]\Script\activate.bat
Linux: source [ve_directory]/bin/activate
pip install [your requirements]
I think it doesn't matter where your current working directory is.
Reference:
http://www.virtualenv.org/en/latest/#the-system-site-packages-option
When you create a new environment with virtualenv, among other things it creates a bash script venv/bin/activate (where venv is the folder you specified when you created the environment; libraries are located there as well, by the way). When you run it in your shell the environment variables become arranged so that pip installs new libraries in this environment's folder. See virtualenv docs for details, section "activate script".

Where is mongoctl after installation?

I've installed mongoctl according to Mongolab's simple instructions, but I can't do anything with the installed package because which mongoctl resolves to nothing.
The site makes it look like pip installs some kind of command line tool, but it seems like it just installs the python package, which would be fine if all of the documentation didn't treat mongoctl as a command line tool.
What's going on?
You can add the following option to your install command to ensure that "mongoctl" exe goes to /usr/local/bin
--install-option="--install-scripts=/usr/local/bin"
Since mongoctl is already installed on your mac, you will probably need to add a --upgrade and a --force-reinstall
So try the following
sudo pip install mongoctl --install-option="--install-scripts=/usr/local/bin" --upgrade --force-reinstall
What OS are you using?
'mongoctl' should be in /usr/local/bin. Check to make sure that directory is in your PATH
-will