When are there enough projective sheaves on a space X? This question is being asked on behalf of a colleague of mine.
Let $X$ be a topological space.  It is well known that the abelian category of sheaves on $X$ has enough injectives: that is, every sheaf can be monomorphically mapped to an injective sheaf.  The proof is similarly well known: one uses the concept of "generators" of an abelian category.
It is also a standard remark in texts on the subject that on a general topological space $X$, the category of sheaves need not have enough projectives: there may exist sheaves which cannot be epimorphically mapped to by a projective sheaf. (Dangerous bend: this means projective in the categorical sense, not a locally free sheaf of modules.)  For instance, Wikipedia remarks that projective space with Zariski topology does not have enough projectives, but that on any spectral space, a space homeomorphic to $\operatorname{Spec}R$, there are enough projective sheaves.
Two questions:


*

*Who knows an actual proof that there are not enough projectives on, say, $\boldsymbol{P}^1$ over the complex numbers with the Zariski topology?  What about the analytic topology, i.e. $\boldsymbol{S}^2$?

*Is there a known necessary and sufficient condition on a topological space $X$ for there to be enough projectives?  

EDIT: I meant the question to be purely for sheaves of abelian groups.  Eric Wofsey points out that the results alluded to above on Wikipedia are not consistent when interpreted in this way, since $\boldsymbol{A}^1$ and $\boldsymbol{P}^1$, over an algebraically closed field $k$, with the Zariski topology are homeomorphic spaces: both have the cofinite topology.
I am pretty sure that when my colleague asked the question, he meant it in the topological category, so I won't try to change that. But the other case is interesting too. What if $(X,\mathcal{O}_X)$ is a locally ringed space. Does the abelian category of sheaves of $\mathcal{O}_X$-modules have enough projectives? I think my earlier warning still applies. Since for a scheme $X$ not every $\mathcal{O}_X$-module is coherent, it is not clear that "projective sheaves" means "locally free sheaves" here, even if we made finiteness and Noetherianity assumptions to get locally free and projective to coincide.
 A: Thinking about the coherent sheaf case, this resembles a question of Totaro. Is his paper The resolution property for schemes and stacks Totaro asks whether, for any finite type variety $X$, and any coherent sheaf $E$ on $X$, there is a vector bundle $V$ on $X$ with a surjection $V \to E$. This question is open and appears to be quite difficult.
A: I just saw this question now.
If $X$ is a Hausdorff space with a basis of compact open sets, then the category of sheaves of abelian groups on $X$ has enough projectives.  Let $R$ be the ring of locally constant functions $f\colon X\to \mathbb Z$ with compact support and pointwise operations.  $R$ is a unital ring iff $X$ is compact, but it is always a ring with local units (i.e., a directed union of unital subrings).  An $R$-module $M$ is unitary if $RM=M$.  This is equivalent to for all $m\in M$, there is an idempotent $e\in R$ with $em=m$.  It follows that the category of unitary $R$-modules has enough projectives (the direct sums of modules of the form $Re$ with $R$ idempotent do the job).
It is known that the category of sheaves of abelian groups on $X$ is equivalent to the category of unitary $R$-modules.  The equivalence takes a sheaf to its global sections with compact support. Thus the category of sheaves of abelian groups on $X$ has enough projectives.
I don't know a precise reference for this folklore. The compact totally disconnected case is easily deduced from Pierce's Memoir of the AMS on modules over commutative regular rings. The modification for the locally compact case is known to those studying representations of reductive groups over local fields. 
A: Here is a sufficient condition.  If a space has finitely many points, or more generally has the property that the intersection of even an infinite number of open sets is itself open, then it will have enough projective sheaves.  In that case there is a minimal open neighborhoods of every point, and the extensions-by-zero of the constant Z-valued sheaf from these minimal open neighborhoods are projective.  
Earlier I had said "minimal open set" instead of "minimal open neighborhood."  It's more accurate this way.
I had felt that these were all the projectives you could get, and Jon shows this is true for locally connected varieties, but now I am very confused about the skyscraper sheaf at a point in a Cantor set, or another totally disconnected space.  Is this projective?
A: Searching for various examples and counterexamples for sheaves, it is sometimes helpful to look at partially ordered sets with the poset topology: a set $U$ is open if and only if $x \in U$ and $x < y$ implies that $y \in U$.
But for such topological spaces the category of sheaves of abelian groups has enough projectives. The sheaf $Z_{\ge x}$, the extension by zero of the constant sheaf on the open set $\{\ge x\}$, is projective. Indeed, $\operatorname{Hom}(Z_{\ge x}, F) = F(\ge x) = F_x$, the stalk at $x$, so $\operatorname{Hom}(Z_{\ge x}, -)$ is an exact functor. 
And any sheaf $F$ is a quotient of direct sums of these: take one sheaf for each element of each stalk $F_x$.
This is essentially the same as David Treumann's answer. The sets with the unique smallest open neighborhood property, also called Alexandrov spaces, are the same as posets once you identify the topologically equivalent points.
A: Valery's version of the argument is better. When I said "extension by zero" I meant "proper pushforward" which as he points out is only extension by zero when the subspace is locally-closed. My hidden assumption that $x$ is a closed point was sneaked into the statement that
$$Z_V \oplus Z_{X-x} \to Z_X$$
is a surjection, which can fail if $x$ is not closed. Valery's argument that $Z_x$ has no projective cover avoids this issue.  
I'm not sure what happens if $X$ is not locally-connected, but in answer to David's query the skyscraper $Z_p$ at a point in the Cantor set $C$ is not projective. The surjection $Z_C \to Z_p$ doesn't split. The stalk of $Z_C$ at $p$ is identified with functions to $Z$ which are constant on some neighbourhood of $p$. Since the composite $Z_p \to Z_C \to Z_{C-p}$ vanishes we see that the only map $Z_p \to Z_C$ is the zero map. In general we can never split off a skyscraper from the constant sheaf at a limit point.
A: About Jon Woolf's answer, it seems to me that the condition that "$x$ is a closed point" was implicitly used: the extension by zero $Z_A$ is only defined for a locally closed subset $A$ (see e.g. Tennison "Sheaf theory," 3.8.6). So $X-x$ must be locally closed. How about the following trivial modification: instead of $Z_X$, consider the sheaf $i_\ast Z$, where $i$ is the inclusion of a point $x$ into $X$.
Suppose that $x$ does not have the smallest open neighborhood and $x$ has a basis of connected neighborhoods. Then $i_\ast Z$ is not a quotient of a projective sheaf $P$. Suppose otherwise. Then for any connected open neighborhood $U$ of $x$, the homomorphism $P(U) \to i_\ast Z(U)$ is zero. This implies that the homomorphism $P \to i_\ast Z$ is zero since it is equivalent to a homomorphism from the stalk $P_x$ to $Z$. Indeed, pick a neighborhood $V$ which is smaller than $U$. We have a surjection $Z_V \to i_\ast Z$. The homomorphism $P \to i_\ast Z$ must factor through $Z_V$, so $P(U) \to i_\ast Z(U)$ must factor through $Z_V(U)$. But $Z_V(U)=0$. This equality may fail if $U$ is not connected however.
So to summarize Jon Woolf and David Treumann, the category of sheaves of abelian groups on a locally connected topological space $X$ has enough projectives iff $X$ is an Alexandrov space.

Surely this must appear in some standard text. Anybody knows a reference? And what about non-locally connected spaces?
For ringed spaces $(X,\mathcal{O}_X)$ one direction is still clear: $X$ being an Alexandrov space implies you'll have enough projectives. But on reflection the other direction, $X$ being a locally connected space without minimal open neighborhoods implies you don't have enough projectives, appears to be rather tricky. One can think of some weird structure sheaves for which the above argument does not go through, in particular $\mathcal{O}_V(U)\ne 0$. So I still wonder what the answer is for ringed spaces.
A: The condition that each point has a minimal open neighbourhood is necessary and sufficient (as suggested by David Treumann above, see his answer for sufficiency).

Suppose $X$ is a topological space with a point $x$ such that any connected neighbourhood of $x$ contains a strictly smaller neighbourhood. Then the category of sheaves of abelian groups on $X$ does not have sufficient projectives.

Proof: Given a connected neighbourhood $U$ of $x$ find a strictly smaller neighbourhood $V$ and consider the cover $\{V , X-x\}$ of $X$. There is a surjection
$$Z_V \oplus Z_{X-x} \to Z_X$$
where $Z_A$ denotes the extension by zero of the constant sheaf with stalk $Z$ on the subspace $A$. If there are enough projectives then there is a projective cover $P \to Z_X$ of the constant sheaf. This must factorise through the above surjection. But by construction $Z_V(U) =0$ and $Z_{X-x}(U) = 0$ so
$$P(U) \to Z_X(U)$$
must be the zero map. By assumption on $X$ this is true for any connected neighbourhood $U$ of $x$ and so the stalk map
$$P_x \to Z_X,x = Z$$
is zero too. This contradicts the fact that $P \to Z_X$ is a projective cover.
A: I can prove that in $\operatorname{Coh}(\boldsymbol{P}^1)$ there aren't enough projective objects by using Serre's duality theorem and some vanishing theorems. But I don't know if this is the case for $\operatorname{Qcoh}(\boldsymbol{P}^1)$.
