With Poetry version: 1.1.13 I get the following error when trying to use Python 2.7.18 via Pyenv...
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
This occurs when 2.7.18 is set up locally (pyenv local 2.7.18) and globally (pyenv global 2.7.18). Running python within the directory in question launches the terminal...
Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:25:05) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
But when I install Python 3.9.6 and set it as the local Python version, Poetry works perfectly correctly!
Has anyone seen this before? Am I missing something?
%USERPROFILE%.poetry\bin\poetry.bat was calling Python3 which can't find Python2 installs. When installing Poetry get-poetry.py is called. The _which_python method (line 666) determines if the call in poetry.bat is Python3 or Python by which version of Python it finds during the install.
If you have already installed Poetry simply modify the poetry.bat file to be python. For future installations with Pyenv ensure that a 2.7 Python version is set as global.
Related
I have read this post but I think it is about using python2 or python3 inside virtual environment.
My problem is bit different, I want to different version of python 3 itself inside virtual environment.
I am using Ubuntu 18.04. I have three different versions of python 3 in my system and all of them seem to work.
They can be started by mentioning specific python version.
eg: python3.6, python3.7, python3.8.
But simply typing python3 will load python 3.7 because it is Anaconda's python version.
sankethbk7777#Lenovo-ideapad:/$ which python3
/home/sankethbk7777/anaconda3/bin/python3
However I want to create a virtual environment with python 3.8 as python version inside it.
(I mean inside my virtual env if I type python3 - python3.8 should boot up).
I tried using this command.
sankethbk7777#Lenovo-ideapad:/$ sudo python3.6 -m venv myproject
sankethbk7777#Lenovo-ideapad:/$ source myproject/bin/activate
(myproject) sankethbk7777#Lenovo-ideapad:/$ python3
Python 3.6.9 (default, Oct 8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Above we can see that it boots python 3.6 when I type python3.
But when I tried the same for python3.8 this error shows up.
sankethbk7777#Lenovo-ideapad:/$ sudo python3.8 -m venv myproject3
Error: Command '['/myproject3/bin/python3.8', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
However, I have a working python3.8.
sankethbk7777#Lenovo-ideapad:/$ python3.8
Python 3.8.7 (default, Dec 21 2020, 20:10:35)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
sankethbk7777#Lenovo-ideapad:/$ which python3.8
/usr/bin/python3.8
I will provide any further information please help me with this.
Looks like you have Anaconda distribution of Python. I'd simply create a conda virtual environment with the version of Python you need -
conda create -n py38 python=3.8
That should create a conda virtual environment named py38 with Python version 3.8
To activate it,
conda activate py38
And that should give you Python version 3.8
I have been working on adding AWS data into Power BI using Python. I have the script that ingests it and it is working. My problem is that Power BI gives me an error. I troubleshoot the error and found something I reckon is the source of it. Just need some help to understand it and fix it.
I have a conda env 'poc' and when I run the Python from Anaconda Navigator everything works. I checked where that Python.exe instance is stored. When I run the Python.exe from that folder it does not work.
Here is the code in the Python console when run from the Anaconda Navigator:
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
import pandas
import os
import sys
os.path.dirname(sys.executable)
'C:\\ProgramData\\Anaconda3\\envs\\poc'
Now I go to the specified directory and run the Python.exe and it gives me the error that the env is not activated and it is.
Python 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
I also tested the whole approach by installing winPython and it worked (I got AWS data into Power BI).
My question is, how can I use conda env 'poc' or what I am doing wrong when trying to use Anaconda and my 'poc' env?
That's because you need to activate the conda env in the anaconda cmd, and then run it from there.
I install python 3.6.5_1 using
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.r
and get
Warning: python 3.6.5_1 is already installed
The currently linked version is 3.7.3
You can use brew switch python 3.6.5_1 to link this version.
I use brew switch python 3.6.5_1 and get
Cleaning /usr/local/Cellar/python/3.6.5_1
Cleaning /usr/local/Cellar/python/3.7.3
4 links created for /usr/local/Cellar/python/3.6.5_1
Typing which python3, there is no output, which python gives
/usr/local/bin/python
and typing python3 gives
-bash: /usr/local/bin/python3: No such file or directory
typing python gives
Python 2.7.15 (default, Nov 27 2018, 21:24:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
How do I make sure that the installed python3.6.5_1 is installed at correct location and is the one referred to by python3?
Extra background :
I have been working with OpenCV for around 5 months now, following this installation guide for installing all requirements including python3.6. I was using this version of brew's python instead of mac's one. Recently I had to install FFmpeg, some errors came up, unwittingly I did something (I don't remember, probably unlinked python) and then I wasn't able to install FFmpeg anyway but also this destroyed my workspace. Right now I keep getting the following error everytime I open up terminal:
-bash: /usr/local/bin/python3: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 and that PATH is
set properly.
I tried brew install python3 and that solves the above warning for virtualenvwrapper. But it installs python3.7.3, whereas I need python3.6 for tensor flow etc.
I installed the PyAutoGUI package using pip install pyautogui.
I can tell it's installed since I can import it using the PyCharm terminal:
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900
64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyautogui
>>> print(pyautogui)
<module 'pyautogui' from 'C:\\python\\anaconda3\\lib\\site packages\\pyautogui\\__init__.py'>
>>>
My problem is: When I try to add it to my project virtual environment, I can't find it on the available packages. Is there any way to add it manualy ?
P.S.: This is how I'm trying to add it:
File>Settings>Project>Project interpreter>install(the green plus button)>available packages>install
Since you cannot find PyAutoGUI on available packages (for me it is there), you can try running
pip install pyautogui
in the pycharm terminal. If you have already installed it in the global site-packages, pip will use the cached files in installation instead of downloading it again.
I work around this problem by uninstalling anaconda python and pycharm then reintalling pycharm and python (not anaconda), now i can add modules to my venvs no problem.
Note: at first, the available packages list was empty until i added "https://pypi.python.org/" to my repositories using the manage repositories button.
I'm trying to install a Python module on my Windows computer. I installed the development version of the NetBeans IDE to use as my Python editor, and it seems that they install Jython 2.5 under their own program folder, and force you to use that installation for development.
I've been trying to install the PyWhois module for half an hour now, and I'm getting pretty infuriated with the kludginess of developing Python on Windows with Netbeans.
Does anyone know how to install modules with this setup? Should I destroy my dev environment and use something else that would be less rage-inducing?
Jython is Python for Java - are you sure this is what you want? I have answered this for "normal" Python for Windows, I assume this is what you are after.
To use Python under Windows, you need to install the Windows binary installer, which you can download from the Python download page. Make sure you choose the binary installer.
Next, you will need to install setuptools, which you can get from the python package index (pypi).
Once you have installed both, you have Python available under Windows. You should be able to open a command prompt and type "python" to get the python prompt, it should look like this:
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Then, to install PyWhois, open a command prompt and type:
C:\>easy_install pywhois
You'll see output like this:
Searching for pywhois
Reading http://pypi.python.org/simple/pywhois/
Best match: pywhois 0.1
Downloading http://pypi.python.org/packages/source/p/pywhois/pywhois-0.1.tar.gz#
md5=b888dcd990574b7b284d9a9f4b300776
Processing pywhois-0.1.tar.gz
Running pywhois-0.1\setup.py -q bdist_egg --dist-dir c:\docume~1\40843\locals~1\
temp\easy_install-hugnul\pywhois-0.1\egg-dist-tmp-aarhii
Adding pywhois 0.1 to easy-install.pth file
Installing pywhois-script.py script to C:\Python27\Scripts
Installing pywhois.exe script to C:\Python27\Scripts
Installing pywhois.exe.manifest script to C:\Python27\Scripts
Installed c:\python27\lib\site-packages\pywhois-0.1-py2.7.egg
Processing dependencies for pywhois
Finished processing dependencies for pywhois
To confirm it is installed, you should be able to import it from Python:
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pywhois
>>>
Netbeans 7.0 has removed Python support (see http://wiki.netbeans.org/Python70Roadmap) for more information.
This http://wiki.python.org/moin/IntegratedDevelopmentEnvironments wiki entry lists some other IDEs you can try.