Getting the error PackageNotFound whenever iam trying to install something using conda - virtualenv

i am trying to create a new env with python 3.6 using conda. i have installed miniforge3 and anaconda. i have tried some the solutions but nothing worked for me.
The error i am getting everytime.
`
(base) hassaanzahid#Hassaans-MacBook-Pro tensorflow-test % conda create --prefix ./env python=3.8
conda activate ./env
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed
PackagesNotFoundError: The following packages are not available from current channels:
- python=3.8
Current channels:
- https://conda.anaconda.org/conda-forge/noarch
- https://conda.anaconda.org/conda-forge/osx-arm64
- https://conda.anaconda.org/co/osx-arm64
- https://conda.anaconda.org/co/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.
EnvironmentLocationNotFound: Not a conda environment: /Users/hassaanzahid/tensorflow-test/env
`
I have tried some of the solutions provided online but none of these worked for me
Solutions i have tried.
conda clean -all
conda clean --index-cache
conda update conda
conda config --append channels conda-forge
conda config --set offline false
i have tried all these command but none of these worked for me.

Related

How can I install Github project for Google Colab?

There is a project on github called Fpocket. This project is not being installed with "pip install ...", but developers share installation commands for conda.
conda config --add channels conda-forge
conda install fpocket
I could not open the project from Google colab as described here (StackOverflow)
Also solution below doesn't work (mentioned here (StackOverflow)
!pip install git+https://github.com/Discngine/fpocket
I am getting an error like
ERROR: File "setup.py" not found for legacy project
git+https://github.com/Discngine/fpocket.
Github project link is here
How can I use this project in Google Colab?
You can install fpocket with the following set of commands:
WARNING: initial run will take about 5 minutes or so to install conda and fpocket.
!pip install -q condacolab
import condacolab
condacolab.install()
!conda config --add channels conda-forge
!conda install fpocket
then try running
!fpocket | head -10
to check the installation, in my case I get
***** POCKET HUNTING BEGINS *****
! Invalid pdb name given.
:||: fpocket 4.0 :||:
Mandatory parameters :
fpocket -f --file pdb or cif file
[ fpocket -F --fileList fileList ]
which makes me believe that fpocket is installed is ready to go.

Conda not executing commands

Background
I installed miniconda on ubuntu server for raspberry pi 4 (instructions were followed from here but instead of the armv7l.sh 32 bit version I installed the Miniconda3-py38_4.11.0-Linux-aarch64.sh one), according to the console and visuals, it seemed to be installed correctly. My goal is to use the environments in Visual Studio Code.
[
*Disclaimer: using this as a visual reference to my console, using console text later as code block
Problem
I am unable to run create, see or do anything that relates to virtual environments and conda updates, with or without base activated.
ubuntu#ubuntu:~$ conda activate base
(base) ubuntu#ubuntu:~$ conda --version
conda 4.12.0
(base) ubuntu#ubuntu:~$ conda list
(base) ubuntu#ubuntu:~$ conda info --envs
(base) ubuntu#ubuntu:~$ deactivate
DeprecationWarning: 'source deactivate' is deprecated. Use 'conda deactivate'.
(base) ubuntu#ubuntu:~$ conda deactivate
ubuntu#ubuntu:~$ conda info --envs
ubuntu#ubuntu:~$ conda list
Question
How can I execute the commands properly to create, clone, list environments in order to be used in Visual Studio Code?

PDAL issues with python3.5

I installed PDAL in Conda Python3.5.6. After manually linked many ".so" files I still got err when I wanted to convert LAS to LAZ file.
Unable to open "libpdalpython.pyx": File not found
Can someone tell me how to fix it??
I have the same problem before, it looks like PDAL and python 3.5 have some conflicts. I solved it by:
conda create -n py36 python = 3.6
conda install -c conda-forge pdal==1.9.0
conda install -c conda-forge python-pdal

Can not access Anaconda/Miniconda environment as virtualenv with pyenv

I'm showing you the steps I use to create a virtualenv based on miniconda based on pyenv-virtualenv docs. Finally you will see that the virtualenv was created but I can't access to it.
1.0. Check my initial pyenv versions:
$ pyenv versions
* system (set by /home/oscar/.python-version)
2.7.9
3.5.1
1.1 Install miniconda:
$ pyenv install miniconda3-4.0.5
$ pyenv versions
* system (set by /home/oscar/.python-version)
2.7.9
3.5.1
miniconda3-4.0.5
1.2. Create the venvtest virtualenv based on miniconda:
$ pyenv virtualenv miniconda3-4.0.5 venvtest
$ pyenv versions
* system (set by /home/oscar/.python-version)
2.7.9
3.5.1
miniconda3-4.0.5
miniconda3-4.0.5/envs/venvtest
venvtest
When I want to check if the virtualenv was created, It doesn't show it. So I can't no access to it :(
$ pyenv virtualenvs
miniconda3-4.0.5 (created from /home/oscar/.pyenv/versions/miniconda3-4.0.5)
$ pyenv activate ... (autocompleting)
--help miniconda3-4.0.5 --unset
Please, I hope you can help me.
https://github.com/yyuu/pyenv-virtualenv/issues/178
A bit late answer. But a similar thing happened to me.
So I used
source /Users/<user_name>/Applications/anaconda3/bin/activate <env_name>
instead of
source activate <env_name>
My recommendation is to not install Miniconda or Anaconda (herein refereed to as *conda) via pyenv. Instead, download the installer from the applicable site and install it as follows.
Eg. I downloaded the installer from the website to ~/Downloads
% cd ~/Downloads
% ls | grep conda
Miniconda3-latest-Linux-x86_64.sh
Run the installer:
% bash Miniconda3-latest-Linux-x86_64.sh
Now most importantly, at the end of the installer when you are prompted Q) Do you wish the installer to initialize Miniconda3 by running conda init? [yes|no], choose no.
Note: If you choose yes, Miniconda or Anaconda will deploy changes into your ~/.bashrc which will start up the *conda environment every time you open a bash session. This will corrupt pyenv.
After the installer is complete, add the following functions* to your ~/.bashrc:
function aconda {
eval "$(${HOME/miniconda3/bin/conda shell.bash hook)"
}
function dconda {
conda deactivate
}
* change the path to conda executable as required.
To launch the *conda environment, open any terminal and type aconda and to deactivate type dconda and that's it.
These instructions are for Linux but should port to Mac easily, not sure about windows though as I don't use it for my development.
I'm new to using the *conda environments and was surprised with the lack of simple instructions so I had to do a bunch of trial and error to get it so PyEnv, which I adore, working correctly. Hopefully this helps some others.
Now that it's 2022, it's time for a new answer...
It appears that the current method for installs of *conda via pyenv is to manage the conda virtual environment with conda's commands.
From the pyenv-virtualenv README:
"You can manage conda environments by conda create as same manner as standard Anaconda/Miniconda installations. To use those environments, you can use pyenv activate and pyenv deactivate... If conda is available, pyenv virtualenv will use it to create environment by conda create." See the Github repo README.md for a command walk-through.

How can I make a list of installed packages in a certain virtualenv?

You can cd to YOUR_ENV/lib/pythonxx/site-packages/ and have a look, but is there any convenient ways?
pip freeze list all the packages installed including the system environment's.
You can list only packages in the virtualenv by
pip freeze --local
or
pip list --local.
This option works irrespective of whether you have global site packages visible in the virtualenv.
Note that restricting the virtualenv to not use global site packages isn't the answer to the problem, because the question is on how to separate the two lists, not how to constrain our workflow to fit limitations of tools.
Credits to #gvalkov's comment here. Cf. also pip issue 85.
Calling pip command inside a virtualenv should list the packages visible/available in the isolated environment. Make sure to use a recent version of virtualenv that uses option --no-site-packages by default. This way the purpose of using virtualenv is to create a python environment without access to packages installed in system python.
Next, make sure you use pip command provided inside the virtualenv (YOUR_ENV/bin/pip). Or just activate the virtualenv (source YOUR_ENV/bin/activate) as a convenient way to call the proper commands for python interpreter or pip
~/Projects$ virtualenv --version
1.9.1
~/Projects$ virtualenv -p /usr/bin/python2.7 demoenv2.7
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in demoenv2.7/bin/python2.7
Also creating executable in demoenv2.7/bin/python
Installing setuptools............................done.
Installing pip...............done.
~/Projects$ cd demoenv2.7/
~/Projects/demoenv2.7$ bin/pip freeze
wsgiref==0.1.2
~/Projects/demoenv2.7$ bin/pip install commandlineapp
Downloading/unpacking commandlineapp
Downloading CommandLineApp-3.0.7.tar.gz (142kB): 142kB downloaded
Running setup.py egg_info for package commandlineapp
Installing collected packages: commandlineapp
Running setup.py install for commandlineapp
Successfully installed commandlineapp
Cleaning up...
~/Projects/demoenv2.7$ bin/pip freeze
CommandLineApp==3.0.7
wsgiref==0.1.2
What's strange in my answer is that package 'wsgiref' is visible inside the virtualenv. Its from my system python. Currently I do not know why, but maybe it is different on your system.
In Python3
pip list
Empty venv is
Package Version
---------- -------
pip 19.2.3
setuptools 41.2.0
To create a new environment
python3 -m venv your_foldername_here
Activate
cd your_foldername_here
source bin/activate
Deactivate
deactivate
You can also stand in the folder and give the virtual environment a name/folder (python3 -m venv name_of_venv).
Venv is a subset of virtualenv that is shipped with Python after 3.3.
list out the installed packages in the virtualenv
step 1:
workon envname
step 2:
pip freeze
it will display the all installed packages and installed packages and versions
If you're still a bit confused about virtualenv you might not pick up how to combine the great tips from the answers by Ioannis and Sascha. I.e. this is the basic command you need:
/YOUR_ENV/bin/pip freeze --local
That can be easily used elsewhere. E.g. here is a convenient and complete answer, suited for getting all the local packages installed in all the environments you set up via virtualenvwrapper:
cd ${WORKON_HOME:-~/.virtualenvs}
for dir in *; do [ -d $dir ] && $dir/bin/pip freeze --local > /tmp/$dir.fl; done
more /tmp/*.fl
why don't you try pip list
Remember I'm using pip version 19.1 on python version 3.7.3
If you are using pip 19.0.3 and python 3.7.4. Then go for pip list command in your virtualenv. It will show all the installed packages with respective versions.
.venv/bin/pip freeze worked for me in bash.
In my case the flask version was only visible under so I had to go to
C:\Users\\AppData\Local\flask\venv\Scripts>pip freeze --local
Using python3 executable only, from:
Gitbash:
winpty my_venv_dir/bin/python -m pip freeze
Linux:
my_venv_dir/bin/python -m pip freeze