Sublime Text: Change default python.dll file - python-3.x

When I try to run some Python code (which works in Anaconda Spyder) in Sublime Text, I get this error:
Python 3.5.1 |Anaconda 2.4.0 (64-bit)| (default, Dec 7 2015, 15:00:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\pandas\__init__.py", line 7, in <module>
from pandas import hashtable, tslib, lib
File "pandas\src\numpy.pxd", line 157, in init pandas.hashtable (pandas\hashtable.c:38262)
File "C:\Anaconda3\lib\site-packages\numpy\__init__.py", line 200, in <module>
from . import add_newdocs
File "C:\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 21, in <module>
from . import _internal # for freeze programs
File "C:\Anaconda3\lib\site-packages\numpy\core\_internal.py", line 14, in <module>
import ctypes
File "C:\Anaconda3\lib\ctypes\__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: Module use of python33.dll conflicts with this version of Python.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 5, in <module>
File "C:\Anaconda3\lib\site-packages\pandas\__init__.py", line 13, in <module>
"extensions first.".format(module))
ImportError: C extension: Module use of python33.dll conflicts with this version of Python. not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.
Although the SublimeREPL is Python 3.5.1, the program seems to be using python33.dll. It seems like it should be using python35.dll.
In C:\Program Files\Sublime Text, I see python33.dll. So, I place it in a temp folder and put python35.dll (from the Anaconda folder) there instead. I restart Sublime Text.
Then, the program doesn't open, saying python33.dll is missing. This makes me think that there's some setting file in Sublime Text that's looking for python33.dll specifically, and it won't accept python35.dll.
I went through Sublime's PackageResourceViewer and couldn't find anything within the Python package that indicated a python33.dll preference. For reference, my PYTHONPATH points to C:\Anaconda3\ which is where my Python installation lies.
Is there any easy way to switch out python33.dll with python35.dll in C:\Program Files\Sublime Text?

As you discovered, you should not do this. Python 3.3.3 is compiled into the Sublime Text 3 binary and is used to run the Python API and plugin system, among other things. Inserting a Python 3.5 .dll will cause all sorts of conflicts between the ABI and the compiled-in bits, killing the program.
So, instead of fiddling around with that, please edit your question and post the code you were trying to run along with detailed information on exactly how you were trying to run it, and we can troubleshoot that instead.

Related

class YAMLObject(metaclass=YAMLObjectMetaclass): invalid syntax for docker-compose up command

On my Linux system two python versions are present 2.7 and 3.6. To use python 3.6. in my PYTHONPATH in .profile file I have kept /usr/local/lib64/python3.6/site-packages and /usr/local/lib/python3.6/site-packages at the top. and there is no entry of python 2.7 path. In my sys.path variable I can see the python2.7 path entries. (dont know how they appear)
now the issue is when I use docker-compose up command it gives me below error. docker-compose version is 1.29.2
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 22, in <module>
from ..bundle import get_image_digests
File "/usr/lib/python2.7/site-packages/compose/bundle.py", line 12, in <module>
from .config.serialize import denormalize_config
File "/usr/lib/python2.7/site-packages/compose/config/__init__.py", line 6, in <module>
from .config import ConfigurationError
File "/usr/lib/python2.7/site-packages/compose/config/config.py", line 13, in <module>
import yaml
File "/usr/local/lib64/python3.6/site-packages/yaml/__init__.py", line 284
class YAMLObject(metaclass=YAMLObjectMetaclass):
^
SyntaxError: invalid syntax
If I add python 2.7 site package path at the top of PYTHONPATH docker-compose works but other programs start failing. I dont want to use python 2.7 how can I use only python 3.6.
Please suggest.

distutils.util missing after upgrading to 3.8

I just upgraded to Pop OS(Ubuntu) 20.04, which upgraded Python 3.7 to 3.8. Now I get this error below when I run sam (from the AWS SAM CLI). Solutions found online all had to do with making sure python3-distutils is installed. I have verified that python3-disutils is installed. /usr/lib/python3.8/distutils looks fine, just not getting picked up for some reason.
One thing I noticed is that in the traceback below, it's using the system-wide pip, while I have a later version of pip installed under my .local. I don't know if those two symptoms are related but looks like I'm missing some config somewhere so none of the 3.8 or user space stuff is picked up.
Build Failed
Error: PythonPipBuilder:ResolveDependencies - Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/pip/_internal/main.py", line 14, in main
from pip._internal.utils.entrypoints import _wrapper
File "/usr/lib/python3/dist-packages/pip/_internal/utils/entrypoints.py", line 3, in <module>
from pip._internal.cli.main import main
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/usr/lib/python3/dist-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/usr/lib/python3/dist-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/usr/lib/python3/dist-packages/pip/_internal/cli/cmdoptions.py", line 19, in <module>
from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils.util'
I have the same issue on Debian Bullseye (or rather mixed Bullseye/Buster).
Package python3-distutils (3.8.6) contains module for Python 3.8 and 3.9 (!).
Old package (3.7.3) for Python 3.7. You have to choose.
My workaround is just copy module.
mkdir -p /usr/lib/python3.7/distutils
cp -a /usr/lib/python3.8/distutils/* /usr/lib/python3.7/distutils/

numpy import error ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

I got the following numpy error. I have tried 1. But it did solve the problem. Would you please let me know how to fix the problem? Thanks.
$ python3
Python 3.8.0a3 (v3.8.0a3:9a448855b5, Mar 25 2019, 17:05:20)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/__init__.py", line 24, in <module>
from . import multiarray
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/multiarray.py", line 14, in <module>
from . import overrides
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/__init__.py", line 54, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.8 from "/Library/Frameworks/Python.framework/Versions/3.8/bin/python3",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: No module named 'numpy.core._multiarray_umath'
The problem is that I had Python 3.8.0a3 installed. I updated it to 3.8.1. Now the problem is solved.

unable to start Anaconda in Windows

I am unable to start anaconda environment after installing some updates following is the error that I get in command prompt
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\MOHIT>conda
Traceback (most recent call last):
File "C:\Users\MOHIT\Anaconda3\Scripts\conda-script.py", line 3, in <module>
import conda.cli
File "C:\Users\MOHIT\Anaconda3\lib\site-packages\conda\cli\__init__.py", line 8, in <module>
from .main import main # NOQA
File "C:\Users\MOHIT\Anaconda3\lib\site-packages\conda\cli\main.py", line 40, in <module>
import importlib
File "C:\Users\MOHIT\Anaconda3\lib\importlib\__init__.py", line 57, in <module>
import types
File "C:\Users\MOHIT\Anaconda3\lib\types.py", line 166, in <module>
import functools as _functools
File "C:\Users\MOHIT\Anaconda3\lib\functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "C:\Users\MOHIT\Anaconda3\lib\weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
C:\Users\MOHIT>
Please help.
When installing conda make sure to UNCHECK "Register Anaconda as the system Python x.x" as shown in the MinicondaInstaller.
Otherwise everything becomes meaningless and you wonder why is this happening to you and you cry a little.
I don't know why this solved the problem for me, but I think it has something to do with keeping your system python and your virtual env python separate. Took me a whole day of work just to debug it.

ImportError after clean install of Tensorflow

I have just followed this tutorial on installing Tensorflow from source on Ubuntu 16.04, for Python 3.5 with full CUDA and GPU support on an Nvidia graphics cards. The installation was successful.
I am unable to import Tensorflow in a Python session.
Here is the terminal output:
user#user:~/Downloads/tensorflow$ python3.5
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "/home/user/Downloads/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/Downloads/tensorflow/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/user/Downloads/tensorflow/tensorflow/python/__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/user/Downloads/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/user/Downloads/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I found the cause of the issue here, which is very trivial and so easy to overlook. It is also mentioned in the tutorial now.
One must simply move into another directory, i.e. out of the folder where all downloaded files especially the where the Git repository is stored.
I found this solution mentioned as a comment in a bug on Github.
If you use TF1.2.0rc2 and CUDNN 6.0 on Windows, creating a copy of cudnn64_6.dll named cudnn64_5.dll, does the thing.

Resources