Let $\pi:X \to S$ be a flat, projective morphism, $S$ irreducible. Suppose that for all $s \in S$, the fiber $X_s$ satisfies $h^2(\mathcal{O}_{X_s})=0$. This means in particular that given an invertible sheaf $\mathcal{L}_0$ on $X_{s_0}$, for some $s_0 \in S$, there exists no obstruction to infinitesimal deformation of the invertible sheaf $\mathcal{L}_0$ (see $\S 6$ of Hartshorne's "Deformation theory"). My question is: does there exist an invertible sheaf $\mathcal{L}$ on $X$ such that $\mathcal{L}_{X_{s_0}} \cong \mathcal{L}_0$? Any reference will be most welcome (I am looking for techniques to go from local to global deformation of invertible sheaves).
The answer is no, even for locally constant families. Let $F$ be a smooth projective variety with an automorphism $\sigma$, and let $L$ be a line bundle on $F$ such that $\sigma^* L$ is not isomorphic to $L$. For example, take $F=\mathbf{P}^1\times \mathbf{P}^1$ with $\sigma$ the coordinateswitching involution, and $L=\mathcal{O}(1,0)$. Take $S$ to be the nodal curve obtained by gluing $0$ to $\infty$ on $\mathbf{P}^1$, and let $X$ be obtained from $F\times \mathbf{P}^1$ by identifying $(f, 0)$ and $(\sigma(f), 1)$. The natural $X\to S$ is a locally trivial fibration with fiber $F$. Take $s$ to be the node and $L_0$ to be $L$.
Think about it this way: in general, suppose that $X\to S$ is nice enough so that there exists a relative Picard scheme $P\to S$. The assumption that $H^2(X_s, \mathcal{O})=0$ for all $s\in S$ implies that $P\to S$ is (formally) smooth, and so every section over a point (i.e. your $\mathcal{L}_0$) extends to an infinitesimal/formal/etale neighborhood. But there is no reason to have a nonzero global section of $P\to S$ at all.

$\begingroup$ Can we say that there exists an open neighbourhood $U$ of $s_0$ and an invertible sheaf on $X_U$ which restricts to $\mathcal{L}_0$? $\endgroup$ – user43198 May 26 '18 at 21:17

2$\begingroup$ Only an etale neighborhood. For a counterexample, take a nontrivial BrauerSeveri variety $X\to S$ (an etale locally trivial fibration with fiber $\mathbf{P}^n$) with $S$ a variety, and $L_0$ to be $\mathcal{O}(1)$ on some fiber $X_s$. This $L_0$ cannot extend to any Zariski neighborhood of $s$. $\endgroup$ – Piotr Achinger May 26 '18 at 21:25

1$\begingroup$ @PiotrAchinger: Piotr, there are two seemingly different $X$ in your answer, and this is slightly confusing. $\endgroup$ – Sasha May 27 '18 at 9:40

$\begingroup$ @Sasha Thanks, the $X$ in the third sentence clearly should have been an $F$. $\endgroup$ – Piotr Achinger May 27 '18 at 18:39