So I'm trying to download discord's API into my venv with pip but it's failing to build PyNaCl. It says that the error is that the 'make' utility is missing from PATH but I just added it in my environment variables and tried running it on cmd to make sure it's properly installed. Any ideas on what could be causing the issue?
I'm running windows 10, python 3.9.1, and pip 20.3.3
Here is the error message:
Note: I can perfectly install the discord module without voice support, however, I want to make use of its voice features and I cannot understand why it's failing to install.
'make' utility is missing from PATH
The cause of this error
This error is caused by a BUG in setup.py of PyNacl source code.
However, even if you fix it, you will encounter more problem since that source code does not intend for building on windows.
If you just want to install PyNacl, see the next section.
If you want to know the detail of that BUG, see the last section.
Installing PyNacl
After Sep 14, 2020, pynacl has abi3 pre-built wheel, so pip install pynacl will automatically download and install it. You don't need to build pynacl by yourself.
You can also manually download
PyNaCl-1.4.0-cp35-abi3-win_amd64.whl and pip install PyNaCl-1.4.0-cp35-abi3-win_amd64.whl (in download dir).
If you get an error, you can use pip install -U pip to upgrade pip and try again.
If you still get an error, you can use pip debug -v to check compatible tags:
If the compatible tags have the "win_amd64" postfix, there should be a "cp35-abi3-win_amd64" tag, and pip install should succeed.
If the compatible tags have the "mingw_x86_64" or "mingw_x86_64_ucrt" postfix, you must build pynacl by yourself (or install win_amd64 python).
pynacl lists libsodium as a dependency. Fortunately, you don't need to build libsodium (which needs make, causing the error you encountered).
You can download pre-built libsodium from https://download.libsodium.org/libsodium/releases/.
download: https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable-mingw.tar.gz
unzip .gz (you can use 7-zip or peazip) and copy the directories ("bin", "lib", "include") in /libsodium-1.0.18-stable-mingw.tar/libsodium-win64 to your mingw installation directory(which also contain "bin", "lib", "include")
finally, use bash (such as git bash): SODIUM_INSTALL=system pip install pynacl.
Then pip will use PEP517 to build and install pynacl for you with pre-built libsodium. Or, you can build by yourself (download the source code from pypi, and in the source code directory):
SODIUM_INSTALL=system python setup.py bdist_wheel
With cmd or powershell, you cannot set environment variable in the bash style. You can use following instead:
$env:SODIUM_INSTALL="system";pip install pynacl
Details of the bug
The error is raised here:
if not which("make"):
raise Exception("ERROR: The 'make' utility is missing from PATH")
And the function which is implemented with a BUG:
def which(name, flags=os.X_OK): # Taken from twisted
result = []
exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
path = os.environ.get('PATH', None)
if path is None:
return []
for p in os.environ.get('PATH', '').split(os.pathsep):
p = os.path.join(p, name)
if os.access(p, flags):
result.append(p)
for e in exts:
pext = p + e
if os.access(pext, flags):
result.append(pext)
return result
In Python3, filter returns an iterator, not a list (python2's filter returns a list). Thus, the "exts" will be "exhausted" in the first iteration. You can replace filter(...) with list(filter(...)) to fix it.
Related
I'm trying to get wxPython to work in a pyenv-based virtualenv with the virtualenv and virtualenvwrapper plugins on MacOS. I've read several questions about making this work, but most of the answers seem to assume that I'm using the system python version, and/or only address one aspect of a broken setup. I haven't yet seen anything that explains what wxPython is checking for when it starts.
I have python 3.7 compiled by pyenv with --enable-framework.
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.7.4
pyenv itself is installed in my homedir from a reasonably recent (within the last couple of weeks) pull from git.
To be clear, none of the tools or libraries in my Python toolchain are installed by Homebrew.
My virtualenv has access to the framework by virtue of --system-site-packages. Having access to the framework and to the display are supposedly all that's required for wxPython to work, yet I'm still getting the same error on start of any test app:
This program needs access to the screen. Please run with a
Framework build of python, and only when you are logged in
on the main display of your Mac.
It looks to me like everything I should need is available.
% pyenv which python3.7
/Users/matt/.pyenv/versions/3.7.4/bin/python3.7
% mkvirtualenv --system-site-packages --python python3.7 wxtest
Running virtualenv with interpreter /Users/matt/.pyenv/shims/python3.7
Already using interpreter /Users/matt/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/bin/python3.7
Using base prefix '/Users/matt/.pyenv/versions/3.7.4/Python.framework/Versions/3.7'
New python executable in /Users/matt/.ve/wxtest/bin/python3.7
Also creating executable in /Users/matt/.ve/wxtest/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /Users/matt/.ve/wxtest/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/matt/.ve/wxtest/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/matt/.ve/wxtest/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/matt/.ve/wxtest/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/matt/.ve/wxtest/bin/get_env_details
% python -m site
sys.path = [
'/Users/matt/devel/wxtest',
'/Users/matt/.ve/wxtest/lib/python37.zip',
'/Users/matt/.ve/wxtest/lib/python3.7',
'/Users/matt/.ve/wxtest/lib/python3.7/lib-dynload',
'/Users/matt/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7',
'/Users/matt/.ve/wxtest/lib/python3.7/site-packages',
'/Users/matt/.pyenv/versions/3.7.4/Python.framework/Versions/3.7/lib/python3.7/site-packages',
]
USER_BASE: '/Users/matt/.local' (exists)
USER_SITE: '/Users/matt/.local/lib/python3.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
% pip install wxPython
Collecting wxPython
[...]
Successfully installed numpy-1.18.0 pillow-6.2.1 six-1.13.0 wxPython-4.0.7.post2
The code for IsDisplayAvailable() is buried in the _core shared object library, so not particularly easy to examine. I'm not a C++ coder, and digging around in the code repository all I've been able to find so far is the docstring in src/_app.i, not the actual code.
On Mac OS X a False return value will mean that wx is not
able to access the window manager, which can happen if logged in
remotely or if running from the normal version of python instead
of the framework version, (i.e., pythonw.)
That list of requirements seem to be satisfied by what I have here. I don't have a pythonw binary, but as the pythonw(1) man page says:
Actually, since Python 2.5, the normal python also allows GUI access, so
python and pythonw are now interchangeable.
Does anyone have an exhaustive list of what wxPython actually expects to find before it runs?
The error you're encountering is likely to be a "brew-hole" (a.k.a homebrew installation/compatibility issue for wxpython v3 and sometimes v4).
To test some issues that might be at hand perform the following in your pyenv:
python --version
python3 --version
How are they installed? Did you use brew?
If brew or any non-anaconda: uninstall all.
Then : reinstall python via the anaconda 2019. (xx >04) packaged version and it gives you 3.7.4 or 3.7.5 depending on what you choose.
reinstall via conda/pip cmd-line the required packages that are not with default install.
Anaconda "base" is your default environment.
Then conda create --name myenv where myenv is any name you give your environment. For example "myPythonwx408" environment.
cmdline: conda activate myenv
... and tada.. up you go...
If the error persist in anaconda env you can post the environment.yml file so I can recreate your environment for testing.
You mention "virtualenv". Is that the actual virtualenv package or just what you are calling the pyenv instance? If the former then try python -m venv instead. The virtualenv package still hides the framework-ness of the parent Python, even after all these years. The venv package is included with Python3 and is a much better/simpler implementation of the concept.
I'm a bit new to Python and all its "deployment" related tools: pip3,setuptools, virtualenv wheel etc, so I hope my question will make sense...anyways it is like so:
I have a Python3 project which is "managed" with virtual environment using virtualenv where all the projects' dependencies are "listed" within the project's setup.py file. The contents of the setup.py files are as follows:
setup(name="MyProjectName",
version="0.1",
description="Some description",
url="someURL",
author="My Name",
author_email="someemail",
license="MIT",
packages=find_packages(),
include_package_data=True,
install_requires=["robotframework", "paramiko"])
As you can see, the only 3rd party packages the project uses (explicitly) are robotframework & paramiko.
Now when I'm deploying the project, I do the following actions (in that order):
Create a virtual environment with the command:
virtualenv -p python3 virtualEnvFolderName
Switching "into" the virtual environment like so (I'm deploying it on a Linux machine):
source virtualEnvFolderName/bin/activate
Running the setup.py script with the install argument to "automatically" install all the project's dependencies with the following command:
python3 setup.py install
--> Up until couple of days ago, all the 3rd party packages (and their "dependencies sub-packages") listed in the setup.py file where downloaded (and then installed) using their whl file, i.e. - for example:The output for the paramiko package installation would have been:
Reading https://pypi.org/simple/paramiko/
Downloading https://files.pythonhosted.org/packages/4b/80/74dace9e48b0ef923633dfb5e48798f58a168e4734bca8ecfaf839ba051a/paramiko-2.6.0-py2.py3-none-any.whl#sha256=99f0179bdc176281d21961a003ffdb2ec369daac1a1007241f53374e376576cf
Best match: paramiko 2.6.0
Processing paramiko-2.6.0-py2.py3-none-any.whl
Installing paramiko-2.6.0-py2.py3-none-any.whl to
--> This way, the installation was very quick (~1-3 seconds per package).
Today, when I performed the same procedure, on the same machine (I'm quiet sure I did not change any settings on my Ubuntu 16.04 machine), for each package the setup.py tried to install, it installed "via" the tar.gz file (i.e. sources ?) and NOT using the whl file --> which takes MUCH longer since for some of the packages it actually builds (complies) all the "underlying C libraries". This "change" makes my "installation procedure" execution time increase from ~20 seconds to ~4 minutes.
My questions are:
a) How can I resolve this situation - preferably without changing the deployment procedure, i.e. - still perform the 3 steps mentioned above, taking into account that perhaps one or more of the commands will be slightly modified (the creation of the virtual environment and/or some additional argument in required to the setup.py ? ).
b) If I have no other option, then using a pip3 install -r requirement.txt ... "procedure" will also be good, if it also will use whl file(s) whenever applicable.
c) If I will need to "switch" my virtual environment "generator" to venv it is OK (and actually preferred, in case it will deploy the project in the "same" duration).
NOTES:
I tested it both on Ubuntu 16.04 and Ubuntu 18.04 machines with Python 3.5 and Python 3.6 respectively.
Thanks !!
It seems like there is no wheel compatible with your environment (operating system, Python interpreter version, CPU bitness) for the current version of the project PyNaCl. If you have a recent version of pip, the command path/to/venv/bin/python -m pip debug --verbose should list the tags that are compatible with your environment, so that you can compare with the list of wheels available on PyPI.
Just installed Anaconda distribution and now any time I try to run python by double clicking a script, or executing it in the command prompt (I'm using windows 10) , it looks for libraries in the anaconda folder rather than my python folder, and then crashes. If I run via the command prompt, I'm able to see the error, which is:
File "C:\Users\bob\Anaconda3\lib\site-packages\pandas__init__.py",
line 19, in
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
I've uninstalled and re-installed Python and numpy multiple times, but it's getting installed in the default python folder, and since I installed the anaconda distribution, the python launcher always looks in the Anaconda folder. I have to run modules from IDLE or not at all.
Is there any way to get Anaconda to play nice with the standard python installation? I'd really like to be able to quickly and easily double click python scripts to run them.
Anaconda comes with pip , you should not need a separate installation. If you need a library not available in anaconda then you would use pip. Both will store your downloaded packages in site-packages. In your scripts folder you should have [usually only one] reference to python. Generally I think anaconda is the preferred repository. I would consider removing " standard installation". If you need two for some reason make sure only one is in your environment variable path. Assuming you don't have the anaconda version in your path; go to the scripts folder ,in the cmd prompt and type
python myscript.py
In the Python 3 docs, it states that the dbm module will use gdbm if it's installed. In my script I use from dbm.gnu import open as dbm_open to try and import the module. It always returns with the exception ImportError: No module named '_gdbm'. I've gone to the gnu website and have downloaded the latest version. I installed it using
./configure --enable-libgdbm-compat, make; make check; make install, and it installed with no errors. I can access the man page for the library but I still can't import it into Python 3.5.2 (Anaconda). How do I install the Python module for gdbm?
I got similar issue though I am not sure which platform you are using.
Steps are:
look for file _gdbm.cpython-"python version"-.so example file: _gdbm.cpython-39-darwin.so
Once you find the path check which python version in directory path.
Try creating same python venv.
Execute your code.
Before this make sure you have install appropriate gdbm version installed on host machine, for mac it's different for ubuntu it's different name.
I am trying to install rpy2 package and getting following error both with
C:\python27>easy_install rpy2
Searching for rpy2
Reading http://pypi.python.org/simple/rpy2/
Reading http://rpy.sourceforge.net
Best match: rpy2 2.3.3
Downloading http://pypi.python.org/packages/source/r/rpy2/rpy2-2.3.3.tar.gz#md5=6cd95eb70645577cb53198ef0a32395e
Processing rpy2-2.3.3.tar.gz
Running rpy2-2.3.3\setup.py -q bdist_egg --dist-dir c:\users\chetan~1\appdata\local\temp\easy_install-wfxip9\rpy2-2.3.3\egg-di
st-tmp-rrezfb
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
Invalid substring
in string
C:\Python27\lib\site-packages\setuptools\command\easy_install.py:921: RuntimeWarning: tp_compare didn't return -1 or -2 for ex
ception
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
error: Setup script exited with Problem while running `"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags`
And when I try pip this is what I get
c:\Python27\Lib\site-packages\django\bin>pip install rpy2
Downloading/unpacking rpy2
Running setup.py egg_info for package rpy2
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
Invalid substring
in string
Problem while running `"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags`
I spent a few days on this too... then I stumbled upon this thread, where a link is given: http://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2
On this page you can find (amongst other useful things) a pre-compiled version of rpy2 for Windows, and for different versions of Python. It apparently only works for R 2.15.3, I did not try it with other versions.
The error
"C:\PROGRA~2\R\R-28~1.0\bin\R" CMD config --ldflags
is probably caused by the absence of unix like tools in windows. (you might also have had an error like
'sh' is not recognized as an internal or external command, operable program or batch file
I finally got it to work on windows 7 by installing Rtools and mingw compiler and changing the setup.py and unixccompiler.py file. See rpy2 install on windows 7
Also the error
%load_ext rmagic
RuntimeError("Unable to locate R.dll within %s" % RHOME)
is caused by rpy2 not able to find R.dll correctly in the code. You can add R_HOME environment variable as eg C:\Program Files\R\R-3.0.2 the outside folder (for details see the link).
Hope this helps..
Recently had to attempt to build this from source. Got the rpy2-2.2.2 version so I can use with with Python 2.6.6 on Oracle Linux.
The solution to getting this to work was to fix a couple of things in the setup.py script.
First, allow get_rconfig() to allow empty strings. If there was a way to flag this, it wasn't obvious to me:
config = RConfig()
for about in ('--ldflags', '--cppflags',
'LAPACK_LIBS', 'BLAS_LIBS'):
#config += get_rconfig(r_home, about)
config += get_rconfig(r_home, about, allow_empty = True)
Secondly, fix a bug with the dropthrough in RConfig.from_string, where it was referencing a non-existent variable:
elif rconfig_m is None:
if allow_empty:
#if allow_empty and (rconfig == ''):
print(cmd + '\nreturned an empty string.\n')
This then allows the R CMD config loops to get parsed and the empty cases (which you will probably encounter if your R build was not built as a shared library) and I am able to complete the cycle with
python setup.py build install