Install poetry in specific folder / partition on Windows 10 - python-poetry

I want to install poetry on my data partition (D:) under Windows 10 Pro.
I know how to install poetry on Windows
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py -UseBasicParsing).Content | python -
The same page specifies that I can chose a custom install directory by setting a system variable
POETRY_HOME=/etc/poetry python get-poetry.py
However the first command I'm using is a Powershell command. The second command rather looks like a bash command.
How to combine the two?

Ok, I just found out that I just can create a user variable the "usual way":
Settings -> "Edit the system environment variables" -> Environment Variables -> User Variable -> New
Name: POETRY_HOME
Value: D:\path\to\my\poetry
then run the installation command shown above. It will pick up the correct installation path

Related

Updating Anaconda fails: Environment Not Writable Error

I'm trying to update Anaconda and its packages using conda update --name root conda, but it fails every time.
Error message : EnvironmentNotWritableError: The current user does not
have write permissions to the target environment. environment
location: C:\ProgramData\Anaconda3
Environment location: C:\ProgramData\Anaconda3. I replaced the root with base, still I get the same error.
Any help?
start your command prompt with run as administrator
If you face this issue in Linux, one of the common reasons can be that the folder "anaconda3" or "anaconda2" has root ownership. This prevents other users from writing into the folder.
This can be resolved by changing the ownership of the folder from root to "USER" by running the command:
sudo chown -R $USER:$USER anaconda3
or sudo chown -R $USER:$USER <path of anaconda 3/2 folder>
Note: How to figure out whether a folder has root ownership?
-- There will be a lock symbol on the top right corner of the respective folder.
Or right-click on the folder->properties and you will be able to see the owner details
The -R argument lets the $USER access all the folders and files within the folder anaconda3 or anaconda2 or any respective folder. It stands for "recursive".
On Windows, search for Anaconda PowerShell Prompt. Right click the program and select Run as administrator. In the command prompt, execute the following command:
conda update -n base -c defaults conda
Your Anaconda should now update without admin related errors.
Open this folder "C:\ProgramData\" and right-click on "\Anaconda3". go to properties -> security and check all the boxes for each user. This worked for me.
If you get this error under Linux when running conda using sudo, you might be suffering from bug #7267:
When logging in as non-root user via sudo, e.g. by:
sudo -u myuser -i
conda seems to assume that it is run as root and raises an error.
The only known workaround seems to be: Add the following line to your ~/.bashrc:
unset SUDO_UID SUDO_GID SUDO_USER
...or unset the ENV variables by running the line in a different way before running conda.
If you mistakenly installed anaconda/miniconda as root/via sudo this can also lead to the same error, then you might want to do the following:
sudo chown -R username /path/to/anaconda3
Tested with conda 4.6.14.
I had installed anaconda via the system installer on OS X in the past, which created a ~/.conda/environments.txt owned by root. Conda could not modify this file, hence the error.
To fix this issue, I changed the ownership of that directory and file to my username:
sudo chown -R $USER ~/.conda
On Windows in general, running command prompt with administrator works. But if you don't want to do that every time, specify Full control permissions of your user (or simply all users) on Anaconda3 directory. Be aware that specifying it for all users allows other users to install their own packages and modify the content.
I had the same issue and the base environment was in C:\ProgramData\Anaconda3. This is the case, when Anaconda is installed for all users.
As a solution, I re-installed Anaconda just for me and now the base environment is in \AppData\Local\Continuum\anaconda3. This now can be updated via conda update without admin privileges.
As an alternative, I would suggest looking at your conda config file.
Reason
Sometimes for creating a virtual env at a specified location other than the pre-defined path at ~/anaconda3/envs we append the conda config file using: conda config --append envs_dirs /path/to/envs where envs_dirs is a specified function in config file for allocating different paths where conda can find your virtual envs. Removing a recently added path in this config file may solve the problem.
Solution
$:> conda config --show envs_dirs
envs_dirs:
- /home/some_recent_path # remove this
- /home/.../anaconda3/envs
Note the value specifing a different directory other than the predefined location, and remove it using
$:> conda config --remove envs_dirs /home/some_recent_path
Now the config file envs_dirs is set to default location of envs. Try creating a new env now.
this line of code on your terminal, solves the problem
$ sudo chown -R $USER:$USER anaconda 3
WINDOWS:
I also got following error while (base) PS E:\Python> conda install ConfigParser
Verifying transaction: failed
EnvironmentNotWritableError: The current user does not have write permissions to the target environment.
environment location: C:\ProgramData\Anaconda3
My solution: Open Command prompt as administrator, then above command again and it worked.
C:\WINDOWS\system32>conda install ConfigParser
Collecting package metadata (current_repodata.json): done Solving environment: done
Package Plan
environment location: C:\ProgramData\Anaconda3
added / updated specs:
- configparser
The following NEW packages will be INSTALLED:
configparser pkgs/main/noarch::configparser-5.0.2-pyhd3eb1b0_0
Proceed ([y]/n)? y
Preparing transaction: done Verifying transaction: done Executing
transaction: done
I had the same problem. The cause for me was that when downloading Anaconda, I chose 'download for all users' instead of 'just for me'. I uninstalled it, re-installed it and corrected that. And I'm not getting this error anymore.
On Windows,
Create a new environment with
conda create --name py35 python=3.5
see conda cheat sheet
Activate this environment
activate py35
Now you don't need to have root access to your new environment.
As mentioned in a comment to the accepted answer, the default environment base requires administrative rights on Windows:
On Windows, if you're trying to install packages into the base
environment (which is installed to C:\ProgramData\Anaconda3), you'll
need admin access. If you first create an environment (which should
install in your user directory under .conda\envs) and activate it, you
no longer need admin right for that environment. Don't forget to
activate the env after creating it. – C.J. Jackson
In my case somehow CONDA_ENVS_PATH was removed, so I was having NotWritableError. So I fixed the error by specifying
CONDA_ENVS_PATH=~/my-envs:/opt/anaconda/envs
in the .bashrc file
I was also suffered by same problem. I resolved the problem by reinstalling anaconda(While installation at this time I selected "just for me" as user) and my problem was solved.Try the same
CONDA UPDATE - NO WRITE ACCESS PROBLEM ## FIXED##
SIMPLE SOLUTION:
Press the Windows+S combination button and type "cmd" into it.
Right click on the Command Prompt App result that shows up and click on "Run as administrator"
Now, in the black window that is open (i.e. your Command prompt), copy and paste the following to check for your version: conda --version
If you want the latest update, then update Conda by running the update command by pasting the following and clicking enter in the command prompt(black window):
conda update conda
If a newer version is available, it will prompt you for a yes/no to install the update. Type "yes" and then press Enter to update.
Deleting file .condarc (eg./root/.condarc) in the user's home directory before installation, resolved the issue.

source conda environment to export QHOME, can't execute q command

I am trying to install kdb on the jupyter-notebook. First I download the 64-bit windows version on https://ondemand.kx.com/ and also download the licence in the email.
Then I open it using window command prompt. I set QHOME and PATH using the following code in command prompt:
setx QHOME "C:\q"
setx PATH "%PATH%;C:\q\w64"
exit
I can run q properly in windows command.
However, when I open Anaconda3 prompt, to run the q, by typing:
activate base
q
The error appears
python.exe: can't open file 'C:\Users\Cecil': [Errno 2] No such file or directory
My directory path in Anaconda is
(base) C:\Users\Cecil M>
And when I open the jupyter-book, the kernel is dead
Is there any step missing here. I have downloaded relative packages, such as kx kdb, kx embedpy, kx jupyterq.
I think the problem is caused by the space in your username.
The Anaconda KDB package is setting the variable QHOME to C:\Users\Cecil M\Anaconda3\q.
The script etc\conda\activate.d\kdb_activate.bat is run when anaconda starts and sets the QHOME variable. Adding quotes to this variable in the script might work, ie
#echo off
set OLD_QHOME=%QHOME%
set QHOME="%CONDA_PREFIX%\q"
If this fails, deleting the kdb_activate.bat script will stop QHOME from being reassigned when Anaconda is started and KDB should load as usual.
Hope this helps
There is a new package available that handles this error. You can install it from anaconda and therefore you don't need to manually change anything. The name of the packages are kdb-3.6-2018.10.23. You upgrade using the command below.
conda upgrade -c kx kdb
Hope this helps.

running MQSC command against a specific installation

In multi installation environment (of IBM MQ v9.0 on windows), I am trying to create a queue manager and set its installation (crtmqm, setmqm) from command prompt, but getting the error:
Command not executed from the installation named by the -n parameter
How do I perform the following actions:
check what the current installation associated with command
prompt.
change the current installation associated with the
command prompt ( basically running command against a specific
installation, which is not necessarily the primary installation).
To answer your two questions:-
To check the current installation associated with the command prompt use the dspmqver command.
To change the current installation associated with the command prompt use the setmqenv command in one of the following ways:-
To set your installation you can either do so using the installation name, e.g.:-
setmqenv -n Installation2
or the path of the installation, e.g.:-
setmqenv -p c:\mqm8000
which has the same result as changing to the directory of the one you want and then telling it you want to change the environment to self (-s), e.g.
cd \mqm8000
setmqenv -s
If you want to run a command using non-primary installation,then you have to go to the installation(i.e bin) directory of the non-primary installation and then execute it from there.
If you want to set an environment then you have to use setmqenv. Following is the infocenter link which talks more about it
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.5.0/com.ibm.mq.ref.adm.doc/q083560_.htm

JPM not recognized as a command

I'm trying to write my fist firefox addon, but I can't seem to get jpm working. My OS is Windows 7. I have node js installed and I'm trying to follow the instructions here to install the add-on sdk. However, after I install jpm and I try running the command, I get the error jpm is not recognized as an internal or external command, operable program, or batch file." below is a screenshot of the command prompt window.
Let's say nodejs folder's path is C:/nodejs/
You can run jpm from the command line, but you must do it from nodejs installation directory.
If you wish to run it from any directory, what you need to do is edit a System Variable called Path, by appending to it the path to your nodejs installation, like this: ;C:\nodejs\. Afterwards open a new terminal (command prompt) session.
So for example: go to Control Panel -> search for "system variable" -> edit system variables -> find "Path" system (not user) variable on the list -> edit it -> append ;C:\nodejs\ to the end of its text -> open new command prompt.
I'm running a Polish version of Windows at the moment, so the guide isn't exact. I'll update it later. By system variable I mean global system environment variable as opposed to user environment variable.
I had the same problem...
when you install jpm using the npm --global option, the package is installed in c:\users\<your-user-name>\AppData\Roaming\npm\
In your example, you can either call jpm by specifying the complete path.
C:\users\B^3\AppData\Roaming\npm\jpm
Or add the C:\users\B^3\AppData\Roaming\npm to the environment variable PATH as suggested by #Sagi

Laravel command is not working - Windows 7

I'm trying to install laravel command installer, but its not working.
Followed link: http://laravel.com/docs/5.1
I have installed composer successfully, in fact composer command is working fine.
After installing composer, I have run this command:
composer global require "laravel/installer=~1.1"
as said in installation doc.
Output of above command in cmd:
Changed current directory to
C:/Users/xXx/AppData/Roaming/Composer ./composer.json
has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
I have also set environment variables in here:
"My Computer" > "Properties" > "Advanced" > "Environment > Variables"
"Path"
.
I have set both variables User variable and System variable. Also restarted the PC.
But when I run laravel command it says:
'laravel' is not recognized as an internal or external command,
operable program or batch file.
I'm using Windows 7.
Any help would be appreciated. Thanks in advance.
First make sure to find the name of you PC's User. Mostly can be
find in
[C:\Users\[USER_NAME]\AppData\Roaming\Composer\vendor\bin]. Now
this will be available once the Laravel is installed in Widows
platform.
Once you confirmed its location. Go to *My Computer" > "Properties"
"Advanced" > "Environment > Variables > Path'*.
Add semi-colon make sure no space.
Add C:\Users\[USER_NAME]\AppData\Roaming\Composer\vendor\bin with
your user name. Restart command prompt, and you're good to go.
I made some detail Laravel in Installing Laravel 5 with XAMPP or Wamp on Windows Platform
i hope your path in environment variable is wrong you have to set path till vendor/bin directory of composer global
C:\Users\xXx\AppData\Roaming\Composer\vendor\bin
than it will start taking all globally install packages as command.
Make sure to place Composer's system-wide vendor bin directory in your $PATH so the laravel executable can be located by your system. This directory exists in different locations based on your operating system; however, some common locations include:
macOS: $HOME/.composer/vendor/bin
Windows: %USERPROFILE%\AppData\Roaming\Composer\vendor\bin
GNU / Linux Distributions: $HOME/.config/composer/vendor/bin or $HOME/.composer/vendor/bin
You could also find the composer's global installation path by running
composer global about and looking up from the first line.
Source : laravel-doc
Did you do composer install? I think that's the problem.

Resources