Skip to content

Commit 29bdc7f

Browse files
committed
Merge pull request #138 from wholmgren/installdocs
rewrite installation doc
2 parents 003dc88 + c7cb422 commit 29bdc7f

File tree

2 files changed

+190
-49
lines changed

2 files changed

+190
-49
lines changed
245 KB
Loading

docs/sphinx/source/installation.rst

Lines changed: 190 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,26 @@
33
Installation
44
============
55

6-
Installing pvlib-python is similar to installing most other scientific
7-
python packages. The instructions below describe how to install
8-
pvlib-python under a few different conditions. Most of the information
9-
on the `Pandas installation page
10-
<http://pandas.pydata.org/pandas-docs/stable/install.html>`_ is also
11-
applicable to pvlib-python.
6+
Installing pvlib-python ranges from trivial to difficult depending
7+
on your python experience, how you want to use pvlib, and your
8+
system configuration.
129

13-
If you have Python
14-
------------------
10+
**Do you already have Python and the NumPy and Pandas libraries?**
1511

16-
To obtain the most recent stable release of pvlib-python, use
17-
`conda <http://conda.pydata.org/docs/>`_ or `pip <https://pip.pypa.io>`_::
12+
If the answer to this is *No*, follow the :ref:`nopython` instructions
13+
to obtain the Anaconda Python distribution before proceeding.
1814

19-
conda install -c pvlib pvlib
15+
**Do you want to use the pvlib-python as-is, or do you want to be
16+
able to edit the source code?**
2017

21-
pip install pvlib
18+
If you want to use pvlib-python *as-is*, follow the simple
19+
:ref:`standardrelease` instructions.
2220

23-
If your system complains that you don't have access privileges or asks
24-
for a password then you're probably trying to install pvlib into your
25-
system's Python distribution. This is usually a bad idea and you should
26-
instead follow the :ref:`nopython` instructions below.
21+
If you want to be able to *edit the source code*, follow the
22+
:ref:`editablelibrary` instructions.
23+
24+
Installing pvlib-python is similar to installing most scientific python
25+
packages, so see the :ref:`references` section for further help.
2726

2827
.. _nopython:
2928

@@ -34,49 +33,191 @@ There are many ways to install Python on your system, but the Anaconda
3433
Scientific Python distribution provides by far the easiest way for new
3534
users to get started. Anaconda includes all of the popular libraries
3635
that you'll need for pvlib, including Pandas, NumPy, and SciPy.
37-
"Anaconda installs cleanly into a single directory, does not require
38-
Administrator or root privileges, does not affect other Python installs
39-
on your system, or interfere with OSX Frameworks." -Anaconda
40-
Documentation.
4136

42-
#. Install the full Anaconda Scientific Python distribution available
43-
`here <https://store.continuum.io/cshop/anaconda/>`_
44-
#. Install pvlib: ``conda install -c pvlib pvlib``
37+
Anaconda installs cleanly into a single directory, does not require
38+
Administrator or root privileges, does not affect other Python installs
39+
on your system, or interfere with OSX Frameworks. -- `The Anaconda
40+
Documentation <https://docs.continuum.io/anaconda/index>`_
41+
42+
#. **Install** the full Anaconda Scientific Python distribution available
43+
`at Continuum.io <https://store.continuum.io/cshop/anaconda/>`_
44+
45+
See the `Anaconda FAQ <http://docs.continuum.io/anaconda/faq.html>`_
46+
for more information.
47+
48+
You can now install pvlib-python by one of the methods below.
49+
50+
51+
.. _standardrelease:
52+
53+
Install standard release
54+
------------------------
55+
56+
To install the most recent stable release of pvlib-python in a
57+
non-editable way, use `conda <http://conda.pydata.org/docs/>`_
58+
(recommended if you use the Anaconda Python distribution) or `pip
59+
<https://pip.pypa.io>`_ (works with any Python distribution)::
60+
61+
conda install -c pvlib pvlib
62+
63+
pip install pvlib
64+
65+
If your system complains that you don't have access privileges or asks
66+
for a password then you're probably trying to install pvlib into your
67+
system's Python distribution. This is usually a bad idea and you should
68+
follow the :ref:`nopython` instructions before installing pvlib.
69+
70+
You may still want to download the Python source code so that you can
71+
easily get all of the Jupyter Notebook tutorials. Either clone the `git
72+
repository <https://github.com/pvlib/pvlib-python>`_ or go to the
73+
`Releases page <https://github.com/pvlib/pvlib-python/releases>`_ to
74+
download the zip file of the most recent release. You can also use the
75+
nbviewer website to choose a tutorial to experiment with. Go to our
76+
`nbviewer tutorial page
77+
<http://nbviewer.jupyter.org/github/pvlib/pvlib-python/tree/master/docs/
78+
tutorials/>`_.
79+
80+
81+
.. _editablelibrary:
82+
83+
Install as an editable library
84+
------------------------------
85+
86+
Installing pvlib-python as an editable library involves 3 steps:
87+
88+
1. :ref:`obtainsource`
89+
2. :ref:`setupenvironment`
90+
3. :ref:`installsource`
91+
92+
None of these steps are particularly challenging, but they become
93+
more difficult when combined.
94+
With a little bit of practice the process will be fast and easy.
95+
Experienced users can easily execute these steps in less than a minute.
96+
You'll get there.
4597

46-
If you have trouble, see the `Anaconda
47-
FAQ <http://docs.continuum.io/anaconda/faq.html>`_, Google your error
48-
messages, or make a new issue on our `Issues
49-
page <https://github.com/pvlib/pvlib-python/issues>`_.
98+
.. _obtainsource:
5099

100+
Obtain the source code
101+
~~~~~~~~~~~~~~~~~~~~~~
51102

52-
Working at the bleeding edge
53-
----------------------------
103+
We will briefly describe how to obtain the pvlib-python source code
104+
using the git/GitHub version control system. We strongly encourage users
105+
to learn how to use these powerful tools (see the :ref:`references`!),
106+
but we also recognize that they can be a substantial roadblock to
107+
getting started with pvlib-python. Therefore, you should know that you
108+
can download a zip file of the most recent development version of the
109+
source code by clicking on the **Download Zip** button on the right side
110+
of our `GitHub page <https://github.com/pvlib/pvlib-python>`_ or
111+
download a zip file of any stable release from our `Releases page
112+
<https://github.com/pvlib/pvlib-python/releases>`_.
113+
114+
Follow these steps to obtain the library using git/GitHub:
115+
116+
#. **Download** the `GitHub Desktop <https://desktop.github.com>`_ application.
117+
#. **Fork** the pvlib-python project by clicking on the "Fork" button on
118+
the upper right corner of the
119+
`pvlib-python GitHub page <https://github.com/pvlib/pvlib-python>`_.
120+
#. **Clone** your fork to your computer using the GitHub Desktop application
121+
by clicking on the *Clone to Desktop* button on your fork's homepage.
122+
This button is circled in the image below. Remember the system path that
123+
you clone the library to.
124+
125+
.. image:: _images/clonebutton.png
126+
127+
Please see GitHub's
128+
`Forking Projects <https://guides.github.com/activities/forking/>`_,
129+
`Fork A Repo <https://help.github.com/articles/fork-a-repo/>`_,
130+
and the `git-scm <https://git-scm.com/documentation>`_ for
131+
more details.
132+
133+
.. _setupenvironment:
134+
135+
Set up a virtual environment
136+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54137

55138
We strongly recommend working in a `virtual environment
56139
<http://astropy.readthedocs.org/en/latest/development/workflow/
57-
virtual_pythons.html>`_ if you're going to use the development versions
58-
of the code. There are many ways to use virtual environments in Python,
59-
but Anaconda again provides the easiest solution:
140+
virtual_pythons.html>`_ if you're going to use an editable version
141+
of the library. You can skip this step if:
60142

61-
#. Create a new conda environment for pvlib and pre-install a
62-
handful of packages into the environment:
63-
``conda create --name pvlibdev python pandas scipy``
64-
#. Activate the new environment: ``source activate pvlibdev``
65-
#. Install the latest development version of pvlib:
143+
#. You already have Anaconda or another scientific Python distribution
144+
#. You don't mind polluting your Python installation with your
145+
development version of pvlib.
146+
#. You don't want to work with multiple versions of pvlib.
66147

67-
#. If you don't plan to modify the source-code:
68-
``pip install git+https://github.com/pvlib/pvlib-python.git``
69-
#. If you do plan to modify the source code:
70-
Use the GitHub GUI application or git command-line tool to
71-
clone this repository to your computer, then navigate your
72-
command-line to the top-level pvlib-python directory,
73-
then ``pip install -e .``
148+
There are many ways to use virtual environments in Python,
149+
but Anaconda again provides the easiest solution. These are often
150+
referred to as *conda environments*, but they're the same for our purposes.
74151

75-
#. You may also consider installing additional packages into your
76-
development environment:
77-
``conda install jupyter ipython seaborn nose flake8``
152+
#. **Create** a new conda environment for pvlib and pre-install
153+
the required packages into the environment:
154+
``conda create --name pvlibdev python pandas scipy``
155+
#. **Activate** the new conda environment: ``source activate pvlibdev``
156+
#. **Install** additional packages into your development environment:
157+
``conda install jupyter ipython matplotlib seaborn nose flake8``
78158

79159
The `conda documentation
80160
<http://conda.pydata.org/docs/using/index.html>`_ has more information
81-
on how to use virtual environments. You can also add ``-h`` to most
82-
conda commands to get help (e.g. ``conda -h`` or ``conda env -h``)
161+
on how to use conda virtual environments. You can also add ``-h`` to most
162+
pip and conda commands to get help (e.g. ``conda -h`` or ``conda env -h``)
163+
164+
.. _installsource:
165+
166+
Install the source code
167+
~~~~~~~~~~~~~~~~~~~~~~~
168+
169+
Good news -- installing the source code is the easiest part!
170+
With your conda/virtual environment still active...
171+
172+
#. **Install** pvlib-python in "development mode" by running
173+
``pip install -e /path/to/your/pvlib-python``.
174+
You remember this path from the clone step, right? It's probably
175+
something like ``C:\Users\%USER%\Documents\GitHub\pvlib-python``
176+
(Windows) or ``/Users/%USER%/Documents/pvlib-python`` (Mac).
177+
#. **Test** your installation by running ``python -c 'import pvlib'``.
178+
You're good to go if it returns without an exception.
179+
180+
The version of pvlib-python that is on that path is now available
181+
as an installed package inside your conda/virtual environment.
182+
183+
Any changes that you make to this pvlib-python will be available inside
184+
your environment. If you run a git checkout, branch, or pull command the
185+
result will be applied to your pvlib-python installation. This
186+
is great for development. Note, however, that you will need to use
187+
Python's ``reload`` function (`python 2
188+
<https://docs.python.org/2/library/functions.html#reload>`_, `python 3
189+
<https://docs.python.org/3/library/importlib.html#importlib.reload>`_)
190+
if you make changes to pvlib during an interactive Python
191+
session (including a Jupyter notebook). Restarting the Python
192+
interpreter will also work.
193+
194+
Remember to ``source activate pvlibdev`` (or whatever you named your
195+
environment) when you start a new shell or terminal.
196+
197+
.. _references:
198+
199+
References
200+
----------
201+
202+
Here are a few recommended references for installing Python packages:
203+
204+
* `The Pandas installation page
205+
<http://pandas.pydata.org/pandas-docs/stable/install.html>`_
206+
* `python4astronomers Modules, Packages, and all that
207+
<https://python4astronomers.github.io/installation/packages.html>`_
208+
* `Python Packaging User Guide
209+
<http://python-packaging-user-guide.readthedocs.org/en/latest/>`_
210+
* `Conda User Guide
211+
<http://conda.pydata.org/docs/index.html>`_
212+
213+
Here are a few recommended references for git and GitHub:
214+
215+
* `The git documentation <https://git-scm.com/doc>`_:
216+
detailed explanations, videos, more links, and cheat sheets. Go here first!
217+
* `Forking Projects <https://guides.github.com/activities/forking/>`_
218+
* `Fork A Repo <https://help.github.com/articles/fork-a-repo/>`_
219+
* `Cloning a repository
220+
<https://help.github.com/articles/cloning-a-repository/>`_
221+
* `Aha! Moments When Learning Git
222+
<http://betterexplained.com/articles/aha-moments-when-learning-git/>`_
223+

0 commit comments

Comments
 (0)