Coder Social home page Coder Social logo

pscondaenvs's People

Contributors

allanlrh avatar bcsharp avatar darkdreamingdan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pscondaenvs's Issues

Activating a read-only environment takes painfully long

Normally, activating an environment takes around one second. But activating a read-only environment on Windows takes almost half a minute.

When installing Anaconda with Visual Studio Installer, Anaconda is installed to C:\Program Files\Anaconda3. This directory, including envs subdirectory, is read-only for the user. The user-writable directory is in ~\.conda\envs. It is still possible to create environments in C:\Program Files\Anaconda3\envs using the administrator prompt, and those environments are available to all users.

A quick test shows that the delay is on executing

conda '..checkenv' $shellType $Name

The purpose of this command is to check whether the target environment does actually exist in good standing, before the current environment (if any) is deactivated and the activation of the target environment is attempted. The time is spent on line 168 in Lib\site-packages\conda\cli\activate.ps1:

conda.install.symlink_conda(prefix, context.root_dir, shell)

The shell variable is 'cmd.exe' instead of 'powershell.exe' because Lib\site-packages\conda\utils.py has the definitions for PowerShell commented out. As if somebody started to write it and the changed their mind.

Breaks with Anaconda multiuser

  1. Install Anaconda3-5.1.0-Windows-x86_64.exe -> Install for All Users -> Add to PATH checked
  2. conda install -n root -c pscondaenvs pscondaenvs
  3. Start -> "cmd" -> Right click -> "run as a different user" -> enter username/password for any other user
  4. in command window "activate root" -> shows "Access is denied" -> environment does not become activated.

"activate" continues to work for the user that installed anaconda, but not for any other users. The only way I have found to fix is to uninstall and reinstall anaconda.

Im not sure if step 2. conda install is running correctly, see the "block is not recognized..." at the end:

conda install -n base -c pscondaenvs pscondaenvs
Solving environment: done

## Package Plan ##

  environment location: C:\ProgramData\Anaconda3

  added / updated specs:
    - pscondaenvs


The following NEW packages will be INSTALLED:

    pscondaenvs: 1.2.4-ha00e74d_0 pscondaenvs

The following packages will be UPDATED:

    conda:       4.4.10-py36_0                --> 4.5.0-py36_0

Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: \ Use 'activate <envname>' or 'deactivate <envname>' in Powershell to manage the current environment.
                                                                                                                      done
(base) C:\Windows\system32>block should really be the equivalent of
'block' is not recognized as an internal or external command,
operable program or batch file.

Scripts assume conda.exe is on execution search path

The activate.ps1 script uses conda.exe to perform some of its tasks. This will fail if conda.exe is not on the search path (the %PATH% environment variable). Since it is possible to install Anaconda without adding its search paths to the user's %PATH%, the script should be able to locate conda.exe even if it is not on the search path.

One possibility could be to inspect the path to the script location and navigate to conda.exe from there. Typically, conda.exe is in the same directory as activate.ps1. On Windows, it is «install dir»\Scripts. On macOS/Linux it is «install dir»/bin.

-Verbose parameter not recognized

It used to be that -Verbose parameter passed to the scripts was equivalent of setting temporarily $VerbosePreference to "Continue" (from the default "SilentlyContinue"). This does not happen anymore.

The scripts now have to handle the parameter explicitly.

Fails for miniconda installation on D-drive

I can't activate my environment. It's a fresh installation, where I just installed Miniconda and created a Python 3.7 environment.

The command line speaks for itself (λ is my Powershell prompt-character).

D:\
λ  conda --version
conda 4.5.5

D:\
λ  conda info --envs
# conda environments:
#
base                  *  D:\Miniconda3
py37                     D:\Miniconda3\envs\py37

D:\
λ  activate py37
Cannot write to function prompt because it is read-only or constant.
At D:\Miniconda3\Scripts\activate.ps1:129 char:1
+ function global:prompt
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (prompt:String) [], SessionStateUnauthorizedAccessException
    + FullyQualifiedErrorId : FunctionNotWritable

Does not work on macOS anymore

It used to work, but one of the recent PowerShell Core updates changed the name of variable $IsOSX to $IsMacOS, breaking the code.

deactivate eats PATH

Following a call to deactivate, the PATH environment variable is left blank. This prevents any further calls to activate (or anything else for that matter). Note: the environment was existing prior to installation of pscondaenvs.

To reproduce:

PS src> conda install -n root -c pscondaenvs pscondaenvs
<...>

The following NEW packages will be INSTALLED:

    pscondaenvs: 1.2.2-hbdbce43_0 pscondaenvs

Proceed ([y]/n)? y

Use 'activate <envname>' or 'deactivate <envname>' in Powershell to manage the current environment.

PS src> $env:PATH
<current system path...>
PS src> activate streakgui
(streakgui) PS src> $env:PATH
<slightly modified path...>
(streakgui) PS src> deactivate

Deactivating environment "streakgui..."


PS src> $env:PATH
PS src> conda
conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ conda
+ ~~~~~
    + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS src> python
python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS src> explorer
explorer : The term 'explorer' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ explorer
+ ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (explorer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

pscondaenvs version: 1.2.2
Conda version: 4.3.30
Powershell version: 5.1.16299.64
python root version: 3.6.2.final.0
Win 10 home 64bits

Installation from Anaconda repository fails

When unstalling pscondaenvs package through conda, the installation fails:

Administrator PS C:\Program Files\Anaconda3> conda install -v -n root -c pscondaenvs pscondaenvs
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment C:\Program Files\Anaconda3:

The following NEW packages will be INSTALLED:

    pscondaenvs: 1.2.0-ha34a360_0 pscondaenvs

Proceed ([y]/n)?

()

===> LINKING PACKAGE: pscondaenvs::pscondaenvs-1.2.0-ha34a360_0 <===
  prefix=C:\Program Files\Anaconda3
  source=C:\Program Files\Anaconda3\pkgs\pscondaenvs-1.2.0-ha34a360_0


$ C:\WINDOWS\system32\cmd.exe /c C:\Program Files\Anaconda3\Scripts\.pscondaenvs-post-link.bat
==> cwd: C:\Program Files\Anaconda3\Scripts <==
==> exit code: 255 <==
==> stdout <==
b'The syntax of the command is incorrect.\r\n'
==> stderr <==
b'The syntax of the command is incorrect.\r\n'


An error occurred while installing package 'pscondaenvs::pscondaenvs-1.2.0-ha34a360_0'.
LinkError: post-link script failed for package pscondaenvs::pscondaenvs-1.2.0-ha34a360_0
running your command again with `-v` will provide additional information
location of failed script: C:\Program Files\Anaconda3\Scripts\.pscondaenvs-post-link.bat
==> script messages <==
<None>

Attempting to roll back.

The same error happens when trying to install under cmd.
The problem is on line 5:

set /p VAR=<tmp_stdout.txt

which the cmd shell sees as:

set /p VAR= 0<tmp_stdout.txt

This needs to be done using FOR ... IN ... DO construct. For instance:

FOR /F "delims=" %%i IN ('CALL powershell.exe -Command Get-ExecutionPolicy') DO SET var=%%i

how to uninstall your script ?

I install this by conda installer, but when I trying to remove it, he told me this
'he environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:




[WinError 127] 找不到指定的程序。
'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.