Python PVLIB error 'erbs() got an unexpected keyword argument 'min_cos_zenith'' - pvlib

I run the following code to estimate DNI and DHI from GHI using the Erbs model available in Sandia's PVLIB.
The original code as here is:
pvlib.irradiance.erbs(ghi, zenith, datetime_or_doy, min_cos_zenith=0.065, max_zenith=87)
My code is:
df= pvlib.irradiance.erbs(df.ghi, sun.zenith, df.index, min_cos_zenith=0.065, max_zenith=85)
But my code returns erbs() got an unexpected keyword argument 'min_cos_zenith'. Any help is appreciated.
I use:
Python 3.7.3
PVLIB 0.6.1
Pandas 0.24.2
EDIT:
Maybe the solution is to upgrade to PVLIB v0.6.2. But, how to upgrade it. In my machine, none of the following works: pip install pvlib, pip install --upgrade pvlib, pip install pvliv ==0.6.2

Just call the function without the new (optional) arguments:
df= pvlib.irradiance.erbs(df.ghi, sun.zenith, df.index)

AS of 2019-04-28 the pvlib version was v0.6.1 which does not yet have the min_cos_zenith optional argument for erbs(). As Will Holmgren commented, a workaround in the meantime would be to install the latest master from GitHub using pip vcs support:
$ pip install -e git+https://github.com/pvlib/pvlib-python.git#master#egg=pvlib

Related

python - pip installs but cannot import

I've read a lot of posts about this but none of the solutions have worked for me. I'm trying to get a module called nsxramlclient installed, shows successful installation with pip but cannot import from any location outside of the /Users/Nathan/Library/Python/2.7/lib/python/site-packages.
Uninstall does work after some fidgeting with brew using the recommendations found with brew doctor. Here are some vitals:
Running OSX python 2.7.10
PIP 18.1
which -a pip = /usr/local/bin/pip
which -a python = shows 2 directories:
/usr/local/bin/python
/usr/bin/python
python -c 'import sys; print(sys.path)'
['', '/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/usr/local/Cellar/python#2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload']
pip list | grep nsxramlclient
nsxramlclient 2.0.7
It has to be a path issue since I'm able to import it from the directory that the module is located. I just don't know the proper method to repair this since I'm fairly new to Python and I don't want to mess it up worse that it is already.
Looks like I did end up getting it to work finally. What I had to do was to re-install python with brew:
brew re-install python#2
then I needed to re-install the modules I needed with pip. Having OTHER issues now but at least this one is fixed.

Import Error with certain modules in pyoptsparse

Hello everyone,
I have installed Openmdao, pyOpt and pyoptsparse on my computer. As my program works with the Scipy optimizer, I tried it with a random optimizer of pyoptsparse (that was 'ALPSO'). It worked and I was happy. But it turns out it seems to be the only one working.
Every time I try to use another one (like 'SLSQP', which is the default optimizer !), i get this message "pyOptSparse Error : There was an error importing the compiled SLSQP module", inside a frame made of '-' and '+'.
Does anybody know what to do ? I am using Ubuntu if it changes something.
Thanks to swryan for the link, i found the answer.
One of the possible answer was to put libgfortran.so.3 in anaconda2/lib, but i already had it.
They were also saying the problem was solved when installing anaconda 4.0+ but i also had the latest version.
What worked for me was to run : conda update libgfortran --force
Doing it without the --force retrogrades the scipy, which seems to disable scipy.optimize.least_squares. If you did that, you can then run conda update scipy --force
Did you get any errors when you ran 'python setup.py install' for pyoptsparse? I looked at the setup.py file for pyoptsparse and there are some instructions in there that you could try:
print("\nTo install, run: python setup.py install --user\n\n"
"To build, run: python setup.py build_ext --inplace\n\n"
"For help on C-compiler options run: python setup.py build --help-compiler\n\n"
"For help on Fortran-compiler options run: python setup.py build --help-fcompiler\n\n"
"To specify a Fortran compiler to use run: python setup.py install --user --fcompiler=<fcompiler name>\n\n"
"For further help run: python setup.py build --help"
)

nltk module installation in pip through cmd

When I tried to run this command:
c:\python27\scripts\pip install nltk-3.2.1-py2.py3-none-any
I am getting the error:
no matching distribution found
Although i have installed nltk from
http://www.lfd.uci.edu/~gohlke/pythonlibs/#nltk
Kindly help.
I am working on Windows 8 64-bit Version
Installing new modules can be a nightmare if you are new to Python.First delete any old versions of NLTK if already installed. Open cmd navigate to C:\Users\user\AppData\Local\Programs\Python\Python35-32\Scripts, the default directory, using the command cd path_name_comes_here. Otherwise goto the path where you have installed python and goto the Scripts subfolder and use this path here onwards. Now the most preferred way is to use pip install module_you_want_to_install for anything in python. Pip automatically fetches everything it needs to install said module.
Simply use pip install nltk.
Another method is to use easy_install requirement_or_URL.
Some rare occasions its best to download the wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs and from there you can simply use pip install downloaded_wheel_name again. But make sure to copy the name of the wheel EXACTLY.
Post installation make sure that your package is accessible from C:\Users\user\AppData\Local\Programs\Python\Python35-32\Lib\site-packages or a similar path depending on where you installed python.
Try Anaconda - Instead . Always works
C:\Users\sanan>conda install -c anaconda nltk
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\sanan\Miniconda3:
The following NEW packages will be INSTALLED:
nltk: 3.2.4-py36_0 anaconda
The following packages will be UPDATED:
conda: 4.3.23-py36_0 --> 4.3.25-py36_0 anaconda
The following packages will be SUPERSEDED by a higher-priority channel:
conda-env: 2.6.0-0 --> 2.6.0-0 anaconda
Proceed ([y]/n)? y
conda-env-2.6. 100% |###############################| Time: 0:00:00 22.84 kB/s
nltk-3.2.4-py3 100% |###############################| Time: 0:00:02 774.24 kB/s
conda-4.3.25-p 100% |###############################| Time: 0:00:00 578.90 kB/s
After installation is complete .
import nltk
print(nltk.__version__)
C:\Public\Code\textnorm>python attempt1.py
3.2.4

Using Point Cloud Library in Python

Hello I am trying to use Point Cloud Library in Python and as I am new to this C++ library and Python I am following the tutorial on http://strawlab.github.io/python-pcl/#pcl.PointCloud
However whenever I try to import pcl and define a module such as pcl.PointCloud() I get the following error;
AttributeError: 'module' object has no attribute 'PointCloud'
I have used sys.path.append to point to the correct directory where the PCL files have been installed as they are not in site packages. It says on the above link that the C++ code has already got Python bindings but I am unsure exactly what files I am trying to call in Python. Does anybody know how to overcome this error and load these modules?
Thanks,
Andrew
Try this,
sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl
After you've done that then you should be able to run:
python3 -c 'import pcl'
and it will return with no error (as opposed to ModuleNotFoundError: No module named 'pcl').
Tested on:
Ubuntu 18.04 LTS
Python 3.6.9
Reference: https://askubuntu.com/a/1170661/922137
Try skipping the parentheses:
from pcl import PointCloud
And then create an instance of PointCloud, for example, p:
p = PointCloud()
Hope it helps!
Looks like you need PCL 1.5.1 and cython 0.16 according to this page: http://strawlab.github.io/python-pcl/
"""https://blog.pollithy.com/python/numpy/pointcloud/tutorial-pypcd"""
python3.6 -m pip install --user git+https://github.com/DanielPollithy/pypcd.git

pip can't find latest versions of a pypi project

I'm trying to install http://pypi.python.org/pypi/django-crowdsourcing/1.1.21 using pip. I'm getting
$ pip install django-crowdsourcing==1.1.21
Downloading/unpacking django-crowdsourcing==1.1.21
Could not find a version that satisfies the requirement django-crowdsourcing==1.1.21 (from versions: )
No distributions matching the version for django-crowdsourcing==1.1.21
If I try an upgrade, it only finds version 1.1.19.
$ pip install -v --upgrade django-crowdsourcing
Downloading/unpacking django-crowdsourcing
Using version 1.1.19 (newest of versions: 1.1.19, 1.1.18, 1.1.17, 1.1.16, 1.1.15, 1.1.14, 1.1.13, 1.1.12, 1.1.11, 1.1.10, 1.1.9, 1.1.8, 1.1.7, 1.1.6)
Downloading django-crowdsourcing-1.1.19.tar.gz (651Kb): 651Kb downloaded
...
Successfully installed django-crowdsourcing
It looks like django-crowdsourcing version 1.1.21 has some good tags
$ hg tags
tip 289:8796aae85e34
1.1.21 288:2f39596495a7
1.1.20 281:fe00699aa3ff
1.1.19 278:17392ea8ea54
and the correct version number in setup.py
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import os
readme_file = os.path.join(os.path.dirname(__file__),
'README')
long_description = open(readme_file).read()
classifiers = [
'Development Status :: 4 - Beta',
'Framework :: Django',
'License :: OSI Approved :: MIT License']
setup(name='django-crowdsourcing',
version='1.1.21',
classifiers=classifiers,
description='Django app for collecting and displaying surveys.',
long_description=long_description,
author='Jacob Smullyan, Dave Smith',
author_email='jsmullyan#gmail.com',
url='http://code.google.com/p/django-crowdsourcing/',
packages=['crowdsourcing', 'crowdsourcing.templatetags'],
license='MIT',
)
PyPi clearly knows about version 1.1.21 since that's what comes up when you go to http://pypi.python.org/pypi/django-crowdsourcing/ Why does pip think version 1.1.19 is the latest version?
Edit
Sheepishly, I forgot to point out I'm the maintainer. #Matthew Schinckel is right. Here are the two commands I needed, which I found out from a tutorial I didn't see before: http://wiki.python.org/moin/Distutils/Tutorial
$ python setup.py register
$ python setup.py sdist upload
There is no packaged file at version 1.1.21. There is one at 1.1.19. Tags in hg mean nothing to pip: it will only download a packaged up file.
Perhaps contact the maintainer, and point out there is no file release with the two most recent versions on pypi.