Virutalenvwrapper with python 3.9 - virtualenvwrapper

I tried setting up virtual environment for Python 3.9 using virtualenvwrapper and got this error.
➜ mkvirtualenv env --python=$(which python3.9)
RuntimeError: failed to query /usr/bin/python3.9 with code 1 err: 'Traceback (most recent call last):\n File "/home/sid/.local/lib/python3.6/site-packages/virtualenv/discovery/py_info.py", line 16, in <module>\n from distutils import dist\nImportError: cannot import name \'dist\' from \'distutils\' (/usr/lib/python3.9/distutils/__init__.py)\n'
What am I missing?

apt-get install -y python3.9-distutils
then it should work fine.

Related

ERROR: gcloud failed to load: No module named 'googlecloudsdk.third_party.apis.binaryauthorization.v1alpha2.binaryauthorization_v1alpha2_messages'

I am trying to install gcloud CLI on macOS 64-bit(x86_64) by following these instructions: https://cloud.google.com/sdk/docs/install
When I run ./google-cloud-sdk/install.sh I get this error:
Welcome to the Google Cloud CLI!
Traceback (most recent call last):
File "/Users/benkula/./google-cloud-sdk/bin/bootstrapping/install.py", line 30, in <module>
from googlecloudsdk import gcloud_main
File "/Users/benkula/google-cloud-sdk/lib/googlecloudsdk/gcloud_main.py", line 37, in <module>
from googlecloudsdk.command_lib.util.apis import yaml_command_translator
File "/Users/benkula/google-cloud-sdk/lib/googlecloudsdk/command_lib/util/apis/yaml_command_translator.py", line 39, in <module>
from googlecloudsdk.command_lib.iam import iam_util
File "/Users/benkula/google-cloud-sdk/lib/googlecloudsdk/command_lib/iam/iam_util.py", line 85, in <module>
binaryauthorization_message_v1alpha2 = core_apis.GetMessagesModule(
File "/Users/benkula/google-cloud-sdk/lib/googlecloudsdk/api_lib/util/apis.py", line 339, in GetMessagesModule
return __import__(api_def.apitools.messages_full_modulepath,
ModuleNotFoundError: No module named 'googlecloudsdk.third_party.apis.binaryauthorization.v1alpha2.binaryauthorization_v1alpha2_messages'
./google-cloud-sdk/bin/gcloud init shows a similar error:
ERROR: gcloud failed to load: No module named 'googlecloudsdk.third_party.apis.binaryauthorization.v1alpha2.binaryauthorization_v1alpha2_messages'
gcloud_main = _import_gcloud_main()
import googlecloudsdk.gcloud_main
from googlecloudsdk.command_lib.util.apis import yaml_command_translator
from googlecloudsdk.command_lib.iam import iam_util
binaryauthorization_message_v1alpha2 = core_apis.GetMessagesModule(
return __import__(api_def.apitools.messages_full_modulepath,
This usually indicates corruption in your gcloud installation or problems with your Python interpreter.
Please verify that the following is the path to a working Python 2.7 or 3.5+ executable:
/Applications/Xcode.app/Contents/Developer/usr/bin/python3
If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable.
If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
https://cloud.google.com/sdk/
Python executable seems to be where it should be, so I don't think that's the problem. I can see it when I run ls /Applications/Xcode.app/Contents/Developer/usr/bin/.
python3 -V shows Python 3.8.9.
What can I do to install gcloud CLI successfully?
I used this command instead, and it worked for me:
curl https://sdk.cloud.google.com | bash
Found here: https://cloud.google.com/sdk/docs/downloads-interactive.

Ubuntu 16.04 -ModuleNotFoundError: No module named 'apt_pkg'

I am trying to run this line of code
$ sudo add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://mariadb.mirror.liquidtelecom.com/repo/10.5/ubuntu xenial main'
I am getting an error-
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 12, in
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
I have tried multiple solutions , nothing seems to work

I have pytorch installed in a environment but import torch produces an error

I have anaconda python3 kernel with pytorch and numpy installed in the environment. In jupyter notebook first line 'import torch' produces error.
I am using anaconda navigator to launch jupyter notebook and enter my environment and see pytorch is installed but not being imported. Tried various dir extensions 'from torch... import * but more error
import torch
ImportError Traceback (most recent call last)
<ipython-input-1-20507c95d9af> in <module>
1
----> 2 import torch
3
4
~/anaconda3/envs/udacity1/lib/python3.6/site-packages/torch/__init__.py in <module>
100 pass
101
--> 102 from torch._C import *
103
104 __all__ += [name for name in dir(_C)
ImportError: /home/frida/anaconda3/envs/udacity1/lib/python3.6/site-packages/torch/lib/libtorch.so.1: undefined symbol: nvrtcGetProgramLogSize
I was able to add this to the end of my path to establish a 'backend ' for my notebook kernel. Thanks to Kris Stern!
-m ipykernel install --user
first get your kernel path with
(which python3)
then connect it using
sudo (your path)/anaconda3/bin/python3 -m ipykernel install --user

Why use command M-x jedi:install-server in Emacs doesn't reply

I am trying to install Jedi for emacs26 using MELPA package by following instructions here --http://tkf.github.io/emacs-jedi/released/.I used pip3 to install 'jedi flake8 autopep8' and I also use M-x package-listto intstall jedi.But When I use M-x jedi:install-server ,It only shows:
Running: pip install --upgrade /home/lzzz/.emacs.d/elpa/jedi-core-20181207.1/...
Runing
After a long time, it didn't reply anything.I don't know what should I do.Is my configure's or network's wrong? I need help.
the jedi error
`Error (jedi):
Failed to start Jedi EPC server.
* EPC Error *
Server may raise an error. Use "M-x epc:pop-to-last-server-process-buffer RET" to see full traceback:
Traceback (most recent call last):
File "/home/lzzz/.emacs.d/elpa/jedi-core-20181207.1/jediepcserver.py", line 39, in
import jedi
ImportError: No module named jedi
* EPC Server Output (last 10 lines) *
Traceback (most recent call last):
File "/home/lzzz/.emacs.d/elpa/jedi-core-20181207.1/jediepcserver.py", line 39, in
import jedi
ImportError: No module named jedi
* EPC Server Config *
Server arguments: ("python" "/home/lzzz/.emacs.d/elpa/jedi-core-20181207.1/jediepcserver.py")
Actual command: /usr/bin/python
VIRTUAL_ENV envvar: nil
* jedi-mode is disabled in # *
Fix the problem and re-enable it.
* You may need to run "M-x jedi:install-server". *
This could solve the problem especially if you haven't run the command yet
since Jedi.el installation or update and if the server complains about
Python module imports.
`
I think the problem may be that Jedi is not starting the server with the same Python environment as the one in which you installed the dependencies.
I would suggest that you first find out which Python executable corresponds to the pip3 you used to install dependencies. Let's say it is /usr/local/bin/python3. Then add the following to your .emacs:
(setq 'jedi:server-command
'("/usr/local/bin/python3" "/home/lzzz/.emacs.d/elpa/jedi-core-20181207.1/jediepcserver.py"))
Then, try to run M-x jedi:ac-setup in a python buffer (you shouldn't need the M-x installe-server since you went for the manual installation).
Hope this helps!

Error installing AutoitLibrary through command line

I need to install robotframework-autoitlibrary to use on my test cases.
My problem is when I try to install AutoIt Library through command line with the following command:
pip install -U robotframework-autoitlibrary --no-cache-dir --pre
I have this error:
C:\windows\system32>pip install -U robotframework-autoitlibrary --no-cache-
dir --pre
Collecting robotframework-autoitlibrary
Downloading
https://files.pythonhosted.org/packages/4e/a4/9e51fe35b1da7a006b773c9c234f78e89bcc4f267152c4e9fa8260631fa8/robotframework-autoitlibrary-1.2.2.zip (701kB)
100% |################################| 706kB 1.6MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\user-a~1\appdata\local\temp\pip-install-
oro1ov\robotframework-autoitlibrary\setup.py", line 93, in <module>
destPath = os.path.normpath(os.path.join(os.getenv("HOMEDRIVE"),
r"\RobotFramework\Extensions\AutoItLibrary"))
File "c:\python27\lib\ntpath.py", line 65, in join
result_drive, result_path = splitdrive(path)
File "c:\python27\lib\ntpath.py", line 115, in splitdrive
if len(p) > 1:
TypeError: object of type 'NoneType' has no len()
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
c:\users\user-a~1\appdata\local\temp\pip-install-oro1ov\robotframework-
autoitlibrary\
My currently installed python packages and their versions are:
Pillow==5.3.0
Pygments==2.3.1
pypiwin32==223
Pypubsub==4.0.0
pywin32==224
robotframework==3.1
robotframework-ride==1.5.2.1
robotframework-selenium2library==3.0.0
robotframework-seleniumlibrary==3.3.0
selenium==3.141.0
six==1.12.0
typing==3.6.6
urllib3==1.24.1
wxPython==4.0.3
I already try this command:
pip install --upgrade setuptools
When input echo %HOMEDRIVE%, the output is:
C:\Users\cmpeixoto>echo %HOMEDRIVE%
C:
Thanks for your help,
The error looks like the environment variable HOMEDRIVE is not set, even though it has a value according to your test (the library installer uses it to copy some files).
Can you try this - manually set it, and straight after that run the pip - in the same Command Prompt (cmd) session:
set HOMEDRIVE=C:
pip install -U robotframework-autoitlibrary --no-cache-dir --pre