I want to use UPnP in my python scripts, so I tried to install miniupnpc through pip install miniupnpc. But It causes an error a little bit after the installation starts:
ERROR: Command errored out with exit status 1:
cwd: C:\Users\sammy\AppData\Local\Temp\pip-install-jrjs0fss\miniupnpc\
Complete output (4 lines):
running install
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
----------------------------------------
I checked the GitHub but I don't know where to find the tools I need to compile the python module or how to use them.
I believe at the time the library was a little bit bugged, I never worked out the issue in the end, I recommend looking for other tools.
It is also worth mentioning I wasn't a very good programmer back then, I now actually understand the nature of libraries and packages.
Related
I am having the error while running jupyter notebook. Error replication:
python --version
Python 3.7.9
python
import win32api
The error was: ImportError: DLL load failed
After doing a some stackoverflow, I got to know that there are 2 dll files missing namely: pythoncom37.dll and pywintypes37.dll
I also got to know that I can run this post command: pywin32_postinstall.py in the Scripts folder. I ran this script. Restarted my pc. I manually download these two dll and copied it to my system32. After manually downloading, I started to have a different type of error: ImportError: DLL load failed: %1 is not a valid Win32 application
I used anaconda and ran my jupyter notebook which was my main aim but can you please make me aware as what is going wrong?
I've run into this recently, but with a different version of the DLLs. What solved it for me was using a different version of pywin32.
My solution (conda env, python 3.8.5):
pip install pywin32==300
or try 225, 227, 228. The latest pywin32 (301 as of this post) seems to be having dll search issues (I wouldn't be surprised if whatever version you were using is also having dll search issues). 301 was released after your issue started, but you may have a similar problem nonetheless.
There is currently an issue on pywin32 DLL loading failing: https://github.com/mhammond/pywin32/issues/1709
Factors involved (in my experience) include your PATH variable (if you're using conda). I haven't tested it myself, but I'd be curious to see if this issue occurs without conda. This issue stops happening for me if the first dlls found are those for 301. In my case, that means putting them in my C:\Windows\System32 folder (yeah I'm on Windows; joy).
So a possible solution #2 would be to run the pywin32 post install script which should be located under your venv/Scripts/pywin32_postinstall.py
To try that solution, open an ADMIN command prompt (very important that it's admin), navigate to your venv, and run:
ppython.exe Scripts\pywin32_postinstall.py --install
You shouldn't HAVE to do this, but if you just need a one-off solution and it works, great!
pip install --upgrade pywin32 ==225 worked for me. Tried version 300 and was unsuccessful.
I was using the Project Gutenberg API (I'm new, forgive me if this isn't actually the right term) with Python 2 just fine. But I needed to start using Python 3 for other reasons.
I'm having a lot of difficulties getting Gutenberg to work with Python 3. I understand (according to this site: https://pypi.org/project/Gutenberg/) that I need to manually install BSD-DB, and I think that's the problem I'm running into.
brew install berkeley-db4
works just fine, but
pip install -r requirements-py3.pip
returns the error:
Could not open requirements file: [Errno 2] No such file or directory: 'requirements-py3.pip'
After research online, I also tried
BERKELEYDB_DIR=$(brew --prefix berkeley-db) YES_I_HAVE_THE_RIGHT_TO_USE_THIS_BERKELEY_DB_VERSION=yes pip install bsddb3
which returns the error:
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/gb/z8bwwygn0y5gcknl24_7bfz40000gn/T/pip-build-_VUMDe/bsddb3/
I'm sorta overwhelmed by all the things that could be going on and starting to feel my lack of coding knowledge. Any nudge in the right direction would be greatly appreciated.
This post summarize my painful but finally successful (just by chance) way to build own conda package for the
netgen meshing tool with Python interface. I found the recipe for the netgen build due to tpaviot.
After cloning the repository into 'netgen-conda' folder I ran:
conda build netgen-conda/netgen-6.2-dev
Which reports "Unsatisfiable dependencies": 'oce', 'gcc-5', 'binutils'.
So I tried to install these packages myself. Unfortunately the documentation do not emphasize the important fact that 'conda build' use its own temporary environment so it doesn't matter what you have installed (see). Nevertheless even installing 'gcc-5' together with 'binutils' manually turns out to be nearly impossible.
Hint for other newbies: Lot of my problems disappear after I learned details about channels.
First try was installing 'gcc-5' with 'binutils' from the 'salford_systems' channel suggested by anaconda:
conda install -c salford_systems binutils gcc-5
But it results in:
ERROR conda.core.link:_execute_actions(337): An error occurred while installing package 'salford_systems::gcc-5-5.3.0-0'.
LinkError: post-link script failed for package salford_systems::gcc-5-5.3.0-0
running your command again with-vwill provide additional information
location of failed script: /home/jb/miniconda3/envs/test/bin/.gcc-5-post-link.sh
Using verbose output ('-v') provides no more info. I was also confused by the fact that the script does not exist on the given path (probably automatically deleted).
With current experience I admit that the reason of problem can be dug out from the '-vv' output (reported issue). After some trying I found that only way to
install both is to first install 'gcc-5' into a clean environment and then install 'binutils'. Since 'conda build' installs everything
from scratch and there is no way to specify order of installed packages I was stuck.
Another issue that puzzled me is the 'conda build' long prefix hack. For unknown reason they use extremely long prefix for an auxiliary folder
which result in various kind of issues. I have faced to three such problems:
As is usual today, I have encrypted HOME causing a known issue.
Using a workaround '--croot /tmp' prevents creating the hard links from '/tmp' into 'HOME/miniconda3' since they are on different filesystems.
There is a fallback to use the copy. I even thought that the fallback doesn't work for a while, but it worked, just making the build running longer.
Trying to install 'gcc' (4.x) from 'default' channel complained about too short prefix. So ultimate workaroud was to set the length of the prefix manually
'--prefix-length 70'.
Finally, I found that the dependency on 'binutils' is not necessary and successfully build the package with:
conda build --prefix-length 70 -c salford_systems -c conda-forge -c dlr-sc netgen-conda/netgen-6.2-dev
Summary (of open questions):
Conda channels introduce a new kind of dependency hell already forgotten when using 'apt-get'. Is there a way to figure out what is a canonical channel for a package.
Does anyone succeed to build with combination 'gcc-5' and 'binutils'?
There is still lack of documentation about internal conda mechanisms and error messages do not provide clue to the problem.
Conda-build use a problematic prefix hack and lack ability to control order of installed packages. Does anybody know the reason for this hack?
I'm trying to install winshell under Python 3.3.0 / Windows 7.
(I should say that I have only a fuzzy notion of how package installing works, so my apologies if I'm making a basic blunder ... this stuff clearly is not really aimed at mere mortals).
What I did was: I opened a CMD window & navigated to the Python33 directory. I typed
pip install winshell
and got "...downloading winshell 0.6 zip followed by running setup.py egg_info for package winshell...
and then I got
python setup.py egg_info failed with error code 1 (in the log file)
I've tried googling generally and in here - most of the posts are moderately incomprehensible - to me at least. There are tentative suggestions in comments to an answer that suggest I'd need to install either pwin32 or win32con. And that pwin32 can't be installed with pip. But I haven't found a definitive 'how to' for installing winshell.
Before I go down either of those rabbit holes, is it correct that, in order to install & use winshell, do I need those modules? And please point me to the best, simple, instructions for doing that.
...
This is all for the purpose of getting the target path of a shortcut as in:
path = winshell.shortcut(filethatisashortcut).path
so as to kludge os.walk to follow shortcuts (Windows, remember!). If there's a more direct method - please advise.
You need to install the pywin32 module according to the docs:
Prerequisites & Compatibility
The module has been tested on versions of Python from 2.4 to 3.2. It may
also work on older (or newer) versions. You’ll need Python 2.5+ for context
manager support. It’s tested with the most recent pywin32 extensions, but
the functionality it uses from those libraries has been in place for many
versions.
(Also looking at the modules imported in the source files, you clearly need to install Python for Windows extensions (pywin32). Don't have access to a windows machine to test, but why don't you go by the book first.)
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