I am having some trouble to use the actual Python version specified by pyenv local.
Z:\>pyenv global
3.10.6
Z:\>pyenv local
3.9.12
Z:\>pyenv which python
C:\xxx\yyy\.pyenv\pyenv-win\versions\3.9.12\python.exe
Z:\>python
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Check if you have another system version of Python installed. If so, check your PATH order in 'Environment Variables'. Make sure that the path to pyenv-win\shims is higher than another installed version.
Related
I am trying to install a rpm with a python script and I see this following error
error: Failed dependencies:
/usr/bin/python is needed by smartnav-3.24-1.0.002.noarch
libnsl.so.1()(64bit) is needed by smartnav-3.24-1.0.002.noarch
but i can find python3.7 in /usr/bin
/usr/bin/python
Python 3.7.1 (default, Feb 6 2023, 06:40:16)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
it is a RHEL Linux environment
I tried symbolic linking but didnt help
I could install with --nodeps, but I dont want to use this flag
Running on Mac Big Sur 11.6.2
Using Python 3.8
Mysql 8.0.29 Homebrew
MYSQLConnection call to #database.setter, i.e. db_conn.database = my_db_name, incorrectly routes to the _mysql_connector c-extenstion, but I don not have the c extension installed, so the call raises an exception. After pip install mysql-connector-python the file WHEEL contains Root-Is-Purelibe: true and top_level.txt is missing _mysql_connector. I expect calling db_conn.database = my_db_name to execute the MySQLConnection class’ database(value) method in connection.py, not route the call to a non-existent _mysql_connector I have been unable to get pip to install the mysql-connector-python with c extension despite trying various suggestions in stackoverflow.
Sorry, I don't a reputation yet to reply in comment to Nuno-Mariz, so posting the following.
I work on the same team as #needpythonhelp, and we have nearly identical macbook pro laptops, they are not M1. We use the the same Pipfile to create a project-specific .venv. His does not get the _mysql_connector, and my .venv does (I don't remember how I got my python 3.8 version a year ago). See difference below. Could his lack of _mysql_connector have anything to do with missing CPPFLAGS or LDFLAGS when his Python version was installed (presumably built from source e.g. pyenv or annaconda)?
My system
clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ python3
Python 3.8.5 (v3.8.5:580fbb018f, Jul 20 2020, 12:11:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
cat .venv/lib/python3.8/site-packages/mysql_connector_python-8.0.23.dist-info/WHEEL
Wheel-Version: 1.0
Generator: bdist_wheel (0.35.1)
Root-Is-Purelib: false
Tag: cp38-cp38-macosx_10_14_x86_64
cat .venv/lib/python3.8/site-packages/mysql_connector_python-8.0.23.dist-info/top_level.txt
_mysql_connector
_mysqlxpb
mysql
mysqlx
ls -la .venv/lib/python3.8/site-packages/_mysql*
-rwxr-xr-x 1 brian staff 7876288 May 25 18:53 .venv/lib/python3.8/site-packages/_mysql_connector.cpython-38-darwin.so
-rwxr-xr-x 1 brian staff 3190548 May 25 18:53 .venv/lib/python3.8/site-packages/_mysqlxpb.cpython-38-darwin.so
needpythonhelp's system
$ clang --version
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
$ python3
Python 3.8.3 (default, Jul 2 2020, 11:26:31)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
his WHEEL file has
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any
top_level.txt
mysql
mysqlx
he does not have either of these in .venv/lib/python3.8/site-packages
_mysqlxpb.cpython-38-darwin.so
_mysql_connector.cpython-38-darwin.so
Edit/Update to the above info
I did a test later today where I used pyenv to install the latest CPython 3.8.13, and built a new .venv from the same Pipfile as noted above. This .venv is like #needpythonhelp's .venv. So now I have one .venv (CPython 3.8.13) that does NOT have _mysql_connector and Root-Is-Purelib: false, etc., and another .venv (from my original CPython 3.8.5 installed a year ago) that does have it.
This is what my Pyenv install today looked like:
❯ pyenv install 3.8:latest
python-build: use openssl#1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.13.tar.xz...
-> https://www.python.org/ftp/python/3.8.13/Python-3.8.13.tar.xz
Installing Python-3.8.13...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.8.13 to /Users/brian/.pyenv/versions/3.8.13
Any ideas on how to consistently get the c-ext when I use pyenv to install new Python versions?
I'm importing debugpy into my code and it works, but VSCode complains that it cannot be imported:
The interpreter shows that I am in the same venv as my terminal:
In my terminal (in VSCode) I can list debugpy and import it at the Python prompt.
(python4uvm_examples) raysalemi#RayProMac python4uvm_examples % pip list | grep debugpy
debugpy 1.4.1
(python4uvm_examples) raysalemi#RayProMac python4uvm_examples % python
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import debugpy
>>>
How do I get VSCode to see that it can be imported?
they have this bug for some time now. what I do - select another interpreter, then re-select the one I need. usually works. (using Pylance as language server).
First, I may have more of an issue with correct environment selection. I did a fresh install of Linux Mint 19 and apt dist-upgrade... etc... and then used apt-get and pip to install pymysql, pil.intertk and pylint for both python and python3 from the cli...
All is good from cli:
~$ python3 --version
Python 3.6.5
~$ pylint3 --version
No config file found, using default configuration
pylint3 1.8.3,
astroid 1.6.0
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0]
python3
Python 3.6.5 (default, Apr 1 2018, 05:46:30)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymysql
>>> import PIL
>>>
After installing VSC.... the only two selection of python environments are 2.7.12 and 3.5.2 ?
I then modified VSC settings with: "python.pythonPath": "/usr/bin/python3"
Which still shows as Python 3.5.2 64-bit within VSC
But here comes my issue that I have tried many suggestions I have found from searching with no luck...
pylint is not finding any module I install. I assume its due to the mix match of version ? But not sure how to resolve that?
When I try to specify the pylint path : "python.linting.pylintPath": "/usr/bin/pylint3"
I get an invalid path error in VSC.. but its a valid path
~$ which pylint3
/usr/bin/pylint3
Any help would be greatly appreciated....
So after some frustrating trail and error I have fixed the issue by uninstalling the Flatpak version of Visual Studio Code listed in the Linux Mint's Software Center... and installing the deb package from the official site.
After installing the deb package... the proper version of python are showing and pylint is working correctly.
so I am trying to draw the graph I already have and I constantly run to an error I do not understand.
File "/usr/local/lib/python2.7/site-packages/pygraphviz/agraph.py", line 1305, in layout
data=self._run_prog(prog,' '.join([args,"-T",fmt]))
File "/usr/local/lib/python2.7/site-packages/pygraphviz/agraph.py", line 1251, in _run_prog
runprog=r'"%s"'%self._get_prog(prog)
File "/usr/local/lib/python2.7/site-packages/pygraphviz/agraph.py", line 1239, in _get_prog
raise ValueError("Program %s not found in path."%prog)
ValueError: Program dot not found in path.
But I have installed graphviz with brew and my path works:
Computer:~ name$ dot -V
dot - graphviz version 2.38.0 (20140413.2041)
So what is wrong?
Why is the program not found? Thanks!
to draw it i do like this
A=nx.to_agraph(graph) # convert to a graphviz graph
A.layout(prog='dot') # neato layout
A.draw(filename+'.png') # write
I've got a similar setup to you (Mac OSX 10.10, brew) and it is working for me.
e.g.
aric:~ aric$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import networkx as nx
>>> A = nx.to_agraph(nx.path_graph(4))
>>> A
<AGraph path_graph(4) <Swig Object of type 'Agraph_t *' at 0x10dbd9600>>
>>> print A
strict graph "path_graph(4)" {
0 -- 1;
1 -- 2;
2 -- 3;
}
>>> A.layout(prog='dot')
>>> A.draw('foo.png')
>>>
aric:~ aric$ brew -v
Homebrew 0.9.5
aric:~ aric$ uname -a
Darwin aric.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64
Maybe something is wrong with your pygraphviz install?
Try
$ python setup_egg.py test
from the pygraphviz source directory and see if it passes.
You might need to
$pip install doctest-skip-unicode
$pip install nose
OK found it digging!
It is eclipse fault and PyDev.
And to be exact, the lack of your $PATH in eclipse settings.
Useful links:
OSX + Eclipse + PyDev - PATH isn't correct
Environment variables in Mac OS X
for me worked:
launchctl setenv PATH $PATH
and restart eclipse. you would have to do it everytime you reboot.
unfortunately it is an apple bug and you can not do much about it.
The other way round is:
ln -s /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse /usr/local/bin/eclipse
and then start eclipse from terminal:
eclipse &
and the PATH variable will be OK. :(